How to give href of a link that set in runtime not in html source code:
there is a download link in a webpage:
<a id="downloadLink" href="">...</a>
but in runtime that link has a href:
<a id="downloadLink" href="http://www.example.com/download/s/eyJjdCI6IkFpc003OERmME1uS3dhR1BQcXg1ckE9PSIsIml2IjoiNzg0OGI5NWRmMmRjZDg0ZjFlMjVjYTM3MjY1MjdjMTUiLCJzIjoiYjU1NTIyN2Q2MmJiODAyMSJ9.mp3">...</a>
I searched in html source and find that it use jquery aes to encrypt and set the link.
How can I access to runtime source code by PHP? file_get_contents()
give me source html code not runtime code
with use of PHP
<a id="downloadLink" href="<?php echo $url?>" download></a>
with use of Jquery
<script>
$(document).ready(function(){
$("#downloadLink").attr('href','example@example.com');
$("#downloadLink").attr('download','download');
});
</script>
I hope the above code helps
Simply do it like the code below. Initialize the variable ($url
) to a url value, then use it to set href=""
value.
<?php
$url = "http://www.example.com/download/s/eyJjdCI6IkFpc003OERmME1uS3dhR1BQcXg1ckE9PSIsIml2IjoiNzg0OGI5NWRmMmRjZDg0ZjFlMjVjYTM3MjY1MjdjMTUiLCJzIjoiYjU1NTIyN2Q2MmJiODAyMSJ9.mp3";
?>
<a id="downloadLink" href="<?php echo $url; ?>">Text To Show</a>