A PHP guru and myself (NOT a guru!) are trying to get a very simple script running. It runs great on his Linux-based apache server, but does not run on mine (Apache 2.2 on FreeBSD9) or the actual server where it will live one day! It simply pulls one stat (a listener count) from a Shoutcast server's XML stats page and returns a single number.
$getstats = file_get_contents('http://myserver.com:8000/stats?sid=1');
$stats = simplexml_load_string($getstats);
Extremely simple as you can see ... no problem seeing the XML page from the Shoutcast server, but for some reason my Apache/PHP-5.3.8 server doesn't like it, and the test server doesn't either. The two of us have been banging our heads for weeks about this. There are other much more complex scripts on the same site, and the server has no problem with those. Any ideas?
Firewall? Check allow_url_fopen too. Add error_reporting(-1); ini_set('display_errors', true); just before it executes too.
Thanks for your quick response. I did add those lines to debug it, and the error I get is:
Notice: Trying to get property of non-object in /home/******/testbed/listeners.php on line 6
And line 6 is the last line:
Also, phpinfo shows allow_url_fopen is ON.
What does var_dump($getstats); give you? false?
Yes, i think so ... it gives this result:
Obviously a problem
This topic is now closed. New replies are no longer allowed.