SHOUTcast - Get stream info
I have a Shoutcast stream up and running (http://lime.citrus3.com:8178/)
And when I try to use the "Shoutcast class" it works fine on my localhost.
When I upload it to my public web server it gives me a time out error (110) which I'm assuming is due to fsock/fsockopen being disabled.
I tried doing a work around using cURL, which worked again on my localhost.
But when I uploaded it to my public web server it just sits there loading, and I think it's trying to download the stream rather then the html page.
I've tried a few snippets from here and there, and they all work on my localhost, but always seem to fail on my web server.
This is part of one of the scripts I'm using, which does work (just not on my silly web server)
PHP Code:
$mysession = curl_init();
curl_setopt($mysession, CURLOPT_URL, "http://$server/admin.cgi?mode=viewxml");
curl_setopt($mysession, CURLOPT_HEADER, false);
curl_setopt($mysession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mysession, CURLOPT_POST, false);
curl_setopt($mysession, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($mysession, CURLOPT_USERPWD, "admin:$password");
curl_setopt($mysession, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($mysession, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$xml = curl_exec($mysession);
curl_close($mysession);
Is there anything i can do to fix this?
Re: SHOUTcast - Get stream info
umm, without being able to play with it myself, I probably can't help you. if you PM me whatever $password is supposed to be, I'll try to take a look.
Re: SHOUTcast - Get stream info
I'd rather not if its all the same :) and you don't need it.
The page that has the information on it, is "http://lime.citrus3.com:8178/index.html"
So if you use the above code, and just forget about the admin page, it's something like:
PHP Code:
$mysession = curl_init();
curl_setopt($mysession, CURLOPT_URL, "http://lime.citrus3.com:8178/index.html");
curl_setopt($mysession, CURLOPT_HEADER, false);
curl_setopt($mysession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mysession, CURLOPT_POST, false);
curl_setopt($mysession, CURLOPT_FOLLOWLOCATION, true); //Tried setting this to false too
$xml = curl_exec($mysession);
curl_close($mysession);
echo $xml;
Even defining the port in the cURL options still makes the script download the stream rather then the page. (Only on my stupid web server)
This is the bit I've been working on. But it still doesn't like it.
Which is funny, because websites like this: http://www.rexswain.com/httpview.html can get the page source no worries at all.
PHP Code:
<?php
$ch = curl_init();
$host = "lime.citrus3.com:8178";
//curl_setopt($ch, CURLOPT_PORT, "8178");
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_REFERER, "None");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_ENCODING, "ISO-8859-1,UTF-8;q=0.7,*;q=0.7");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);
echo $contents
?>