Possible to read JavaScript results into a string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have an external JavaScript that I use on several of my sites. It returns a web counter and does some other logging. It's accessed like this:

<script language="javascript" src="http://www.mydomain.com/log.js";></ script>

No rocket science there, this is common and it works great. That call returns a block like this:

document.write('<a bunch of html>')

What I want to know is: is it possible to retrieve the above outputted code into a string, rather than outputting it directly to the browser? Nothing I've tried works, and I also tried this using a Google AdSense call to make sure there was not a problem in my JavaScript. Here's what I tried and what happened:

<?php
$x = file_get_contents('http://www.mydomain.com/log.js');
// also tried urlencode() but that did not help
?>

The result:

Warning: main(http://www.mydomain.com/log.js) [function.main]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in c: \Inetpub\wwwroot\test.php on line 2

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux