thewoose — 2012-05-08T17:08:56-04:00 — #1
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?
anthonysterling — 2012-05-08T17:13:22-04:00 — #2
Firewall? Check allow_url_fopen too. Add error_reporting(-1); ini_set('display_errors', true); just before it executes too.
thewoose — 2012-05-08T17:31:36-04:00 — #3
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.
anthonysterling — 2012-05-08T17:38:47-04:00 — #4
What does var_dump($getstats); give you? false?
thewoose — 2012-05-08T18:00:05-04:00 — #5
Yes, i think so ... it gives this result:
Obviously a problem