I was wondering if there was some way to get a javascript variable from another url into a variable within PHP?
For example:
A page called exampleurl.com/page (which I do not have control over) with some inline javascript like:
function examplefunction() {
evar = "http://ikmp.co/Usdfio1";
}
Assuming there's HTML and other javascript surrounding this variable I want, how would I be able to retrieve it? Is there a special function to do this, or would it be easier to simply parse the HTML through PHP and then trim the variable to what I want?
In theory, the PHP would have a URL set to retrieve the JS from, and it would echo only what is in that variable.
PHP code (hypothetical) at mysite.com/getvariable.php:
$url = 'exampleurl.com/page';
$js_var = get_js_data($url, $evar);
echo $js_var;
Thanks in advance to anyone who can help me out here!