Click to See Complete Forum and Search --> : javascript output in to php-var?


stuntgirl
03-14-2003, 02:16 PM
i have the following problem:

the js-script output of a script is a number.
i want to get this number into a php var.
how do i do that?

-------
$lgz5on5 = <SCRIPT language="JavaScript" type="text/javascript" src="http://www.leaguez.com/extern/?clan=7333&ladder=8&type=1"></script>
-------

please help!
thanks in advance

AdamBrill
03-14-2003, 03:12 PM
Since PHP only runs once when the page loads, you can't get the information directly into a PHP variable. You have to make a hidden input field and get the data out of that. Or, since it looks like you are using a external file, you could just read the file and get the information that way. Something like this should work:<?PHP
$filename = "http://www.leaguez.com/extern/?clan=7333&ladder=8&type=1";
$fp = file($filename);
if($fp){
$content = "";
$x=0;
while($fp[$x]){
$content.=$fp[$x];
$x++;
}
echo $content;
}
?>The variable $content has the data out of the file. Let me know if you need any more help. ;)

stuntgirl
03-14-2003, 05:54 PM
thank u very much, adam. it worked.
excellent solution.

AdamBrill
03-14-2003, 05:57 PM
No problem. I'm glad I could help. :)