[Icecast] Parsing /admin/stats with PHP

Timo Häkli timpuri at kepit.fi
Sun Mar 4 11:02:09 UTC 2007


Hi!

Try to use curl for http query. Maybe fopen does not support Basic  
authentication.

Code will be something like this: (not tested)

$server = "www.dallypost.com:8000";
$user = "admin";
$passw = "my_pass_word";
$mountpoint = "/DallyPostRadio.ogg";

$url = "http://$user:$passw@$server/admin/stats";

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
$statuspage = curl_exec($ch);
curl_close ($ch);

if (curl_errno($ch)) {
    $curl_error = curl_error($ch);
    die( "Error reading Icecast data from $server. Curl error:  
$curl_error" );
}


Timo


Lance Earl kirjoitti 4.3.2007 kello 12:15:

> I am trying to connect to my icecast server with the following php  
> script and I keep getting an error. Script and errot follow:
>
> $server = "www.dallypost.com:8000";
> $user = "admin";
> $passw = "my_pass_word";
> $mountpoint = "/DallyPostRadio.ogg";
>
> $fp = fopen("http://$user:$passw@$server/admin/stats","r")
>         or die("Error reading Icecast data from $server.");
>
> ______________________________________________
>
>
> *Warning*: fopen(http://...@www.dallypost.com:8000/admin/stats)  
> [function.fopen <http://www.dallypost.com/a/radio/function.fopen>]:  
> failed to open stream: HTTP request failed! HTTP/1.0 401  
> Authentication Required in */var/www/a/radio/server_data.php* on  
> line *8*
> Error reading Icecast data from www.dallypost.com:8000.
>
>
> I sure will appreciate any help
>
> Lance
> _______________________________________________
> Icecast mailing list
> Icecast at xiph.org
> http://lists.xiph.org/mailman/listinfo/icecast




More information about the Icecast mailing list