Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

record audio streaming

Links for php scripts

Moderators: macek, egami, gesf

record audio streaming

Postby webstreamer » Sun Apr 08, 2012 3:35 am

Hi Friends,
we want to record a shoutcast in audio format and then save on our server...please any one suggest me
I want to record a streaming audio from and save the fiile on our server so how can i record the streaming video i use some thing like this code please check that is correct or not:--


// cron podcast script

$fileday = date('l');

$filetime = date('H:i');
echo $fileday;
echo $filetime;

$dbhost="localhost"; // Host name

$dbusername="username"; // Mysql username

$dbpassword="password"; // Mysql password

$db_name="database name"; // Database name

// Do Not Edit Below This Line CORE SITE CODE

// Mysql db Connection

mysql_connect("$dbhost", "$dbusername", "$dbpassword")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

// check if we need to record

$SQLtext = "SELECT * FROM timetable WHERE cast_day='$fileday' AND start_time='$filetime'";

$result = mysql_query($SQLtext);

while($row = mysql_fetch_row($result)) {

$process = "start";

$filer = $row[3]; // dj name

$filetime_chk = $row[1]; // start time

$fileday_chk = $row[6]; // day

$lengthr = $row[2]; // length

// additional info now

$dj_img = $row[4]; // djs image

$genre = $row[5]; // genre

$cast_active = "no"; // dont make active untill complete


// end check


$curlpath = "/usr/bin/curl"; // path to curl

$folder = "/podcasts/"; // ensure folder has chmod 777

$directory = "podcasts/"; // recordings folder name

$rstream = "";


$addfile = date('d-m');

$filerec2 = "$filer-$addfile";

$filerec = str_replace(" ","_",$filerec2);

$truefile = "$folder$filerec".'.mp3';

$podname = "$filerec.mp3";

if ($process == "start") {

$sql="INSERT INTO podcasts (start_time, show_length, dj_name, dj_image, genre, cast_day, cast_active, podcast_file,file_rec) VALUES ('$filetime_chk','$lengthr','$filer','$dj_img','$genre','$fileday_chk','$cast_active','$podname','$addfile')";

$r = mysql_query($sql) or die("A MySQL error has occurred.<br />Your Query: " . $your_query . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());

echo $podname;
$reccom = "curl -m $lengthr $rstream >$truefile";

$last_line = system("$reccom");
echo $last_line;

echo "<br>Running Command $reccom <br>";

} else {
echo "Sorry Nothing to do Atm";


I mean record a shoutcast audio stream in php
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Apr 08, 2012 3:08 am

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.