note 85262 added to function.fsockopen
| From: | Michael at osu1 dot php dot net | Date: | Fri, 22 Aug 2008 11:47:40 +0000 |
| Subject: | note 85262 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143744@lists.php.net to get a copy of this message | ||
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
----
Server IP: 82.160.94.10
Probable Submitter: 89.79.17.243
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- https://master.php.net/note/edit/85262
Del: integrated -- https://master.php.net/note/delete/85262/integrated
Del: useless -- https://master.php.net/note/delete/85262/useless
Del: bad code -- https://master.php.net/note/delete/85262/bad+code
Del: spam -- https://master.php.net/note/delete/85262/spam
Del: non-english -- https://master.php.net/note/delete/85262/non-english
Del: in docs -- https://master.php.net/note/delete/85262/in+docs
Del: other reasons-- https://master.php.net/note/delete/85262
Reject -- https://master.php.net/note/reject/85262
Search -- https://master.php.net/manage/user-notes.php