note 85262 deleted from function.fsockopen by tularis
| From: | tularis@php.net | Date: | Fri, 22 Aug 2008 15:08:48 +0000 |
| Subject: | note 85262 deleted from function.fsockopen by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143750@lists.php.net to get a copy of this message | ||
Note Submitter: Michael
----
Hi,
While I listen stream audio on winamp i can see title, artist, etc. I tried to make php script (this
is for digitally imported radio station) that would get artist and title from stream, but.. it
don't works :/
[yes, I know that is newb code :D]
<?php
$fp = fsockopen("scfire-nyk-aa01.stream.aol.com", 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "GET /stream/1065 HTTP/1.1\r\n";
$out .= "Host: scfire-nyk-aa01.stream.aol.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fputs($fp, $out);
for ($i = 0; $i < 9; $i++)
{
$content .= fgetss($fp, 1024);
}
fclose($fp);
}
$content = explode("\r\n", $content);
echo('<PRE>');
print_r($content);
echo('</PRE>');
?>
And I get only this:
Array
(
[0] => ICY 200 OK
[1] => icy-notice1: This stream requires Winamp
[2] => icy-notice2: Firehose Ultravox/SHOUTcast Relay Server/Linux v2.6.0
[3] => icy-name: D I G I T A L L Y - I M P O R T E D - Vocal Trance - a fusion of trance,
dance, and chilling vocals together!
[4] => icy-genre: Vocal Trance Dance Pop
[5] => icy-url: http://www.di.fm
[6] => content-type: audio/mpeg
[7] => icy-pub: 1
[8] => icy-br: 96
[9] =>
)
.. No artist/title data, that WinAMP gets somehow :(
Can someone tell me how to take artist/title from stream? :)
So or so, regards,
Michael