Kingy Posted October 20, 2008 Share Posted October 20, 2008 I'm trying to get the contents of a shoutcast radio webpage. The code i'm using is: $file = "http://69.64.58.2:8000"; $data = file_get_contents($file); obviously nothing special about that, but when i navigate to the page, it spits out the error: "failed to open stream: HTTP request failed! ICY 401 Service Unavailable" now that is when the radio is offline. when its online it gives this error: "failed to open stream: HTTP request failed! ICY 200 OK" but as you can see when you navigate to the radio page there is a lot of information regardless. Any ideas on why its giving the error and not bringing back the contents? Link to comment https://forums.phpfreaks.com/topic/129327-solved-file_get_contents/ Share on other sites More sharing options...
Kingy Posted October 21, 2008 Author Share Posted October 21, 2008 Ok I managed to figure out the problem. I needed to set the user_agent. <?php ini_set("user_agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"); $html = file_get_contents("http://www.yoursitehere.com"); echo $html; ?> Link to comment https://forums.phpfreaks.com/topic/129327-solved-file_get_contents/#findComment-670481 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.