Icecast2 PHP Source

Talk about Audio On Demand or Streaming
Post Reply
diogopms
Posts: 3
Joined: Tue Oct 05, 2010 5:36 pm

Icecast2 PHP Source

Post by diogopms »

I have this PHP code:

I need to create my own souce to interact with icecast2.

<?php
$headers = array(
"Authorization: Basic c291cmNlOmNoYW5nZW1l",
"User-Agent: libshout/2.2.2",
"Content-Type: audio/mpeg",
"ice-name: my name",
"ice-public: 1",
"ice-url: http://www.mydomain.com",
"ice-genre: rock",
"ice-audio-info: bitrate=128;channels=2;samplerate=44100",
"ice-description: This is a stream description"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://main:8000/radio");
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize('some.mp3'));
curl_setopt($ch, CURLOPT_INFILE, fopen('some.mp3', 'rb'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "SOURCE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$b = curl_exec($ch);

echo $b;
curl_close($ch);
?>


This code don't work for me...
Any have a lite code to simulate de source in PHP or C#

Please help me, i need a urgent solution (sorry for pression)
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Re: Icecast2 PHP Source

Post by Jay »

Any particular reason for using curl? Icecast requires a SOURCE request, not sure if that is possible in curl.
- Jay
diogopms
Posts: 3
Joined: Tue Oct 05, 2010 5:36 pm

Re: Icecast2 PHP Source

Post by diogopms »

if possible give me an example in any language

I don't see any code on internet...

thank's for your help and atencion..
diogopms
Posts: 3
Joined: Tue Oct 05, 2010 5:36 pm

Re: Icecast2 PHP Source

Post by diogopms »

I need a port for C# to streaming using C# player..

But i need to understand how protocol works...

Thank's a lot..
Post Reply