Hello group,
I know that it's not possible to get variables from javascript. So I try to think how to get it in other way. First I wanted to do this:
$someVar = getSomeJScriptPage()
function getSomeJScriptPage()
{
$url = "http://myserv/page.php";
$start = "<STARTGRAB>";
$end = "</ENDGRAB>";
$file = fopen("$url", "r");
if (!$file)
{
return "-1";
}
else
{
$file = fread($file, 100);
$file = eregi("$start(.*)$end", $file, $carType);
return $carType[1];
fclose($file); //- DO NOT CHANGE
}
}
And this page.php has Jscript inside, which will produce something like this <STARTGRAB>2393</STARTGRAB>.
It was good idea, but of course it's not working, why ?? Becouse PHP gets the source of this page, so in other words it grabs this:
document.write('2393');
And I start to think how to do this in other way... And my question is how to make some php var from Jscript. I know that there was many post about this, but maybe my example above will produce some new ideas about this problem.
Cu.