Old 24th November 2013, 23:48   #1
trravel
Junior Member
 
Join Date: Nov 2013
Posts: 2
Shoutcast API AJAX DJLIST

Hi,

can anyone of you give an example of how I use the api in ajax, html or php can use? I am not an ajax benefited & the wiki that I do not understand so - hope to help

greeting

PHP Code:
<?php



$tc2_link 
"xxx";
$tc2_port "xxx";
$tc2_target '/api'
$tc2_user "admin";
$tc2_pass "xxx";

$timeout 30


$posts = array ( 'op' => 'ListDJS',
 
'seq' => '' ); 



$method "POST"

foreach( 
$posts AS $name => $value ){ 
    
$postValues .= urlencode$name ) . "=" urlencode$value ) . '&'


$postValues substr$postValues0, -); 
$lenght strlen$postValues ); 

$request "$method $tc2_target HTTP/1.1\r\n"
// $request .= "User-Agent: XML Getter (Mozilla Compatible)\r\n"; 
$request .= "Authorization: Basic ".base64_encode("$tc2_user:$tc2_pass")."\r\n";
$request .= "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n";
$request .= "Content-Length: $lenght\r\n"
$request .= "\r\n"
$request .= $postValues

$socket fsockopen$tc2_link$tc2_port$errno$errstr$timeout ); 

fputs$socket$request ); 
$ret ''

// while ( !feof( $socket ) ) { 
    
$ret fgets$socket4096 ); 
// } 

fclose$socket ); 

echo 
"Adresse: ".$tc2_link." - Port: ".$tc2_port." - ErrNo: ".$errno." - Fehler: ".$errstr." - TO: ".$timeout."<br><br>\r\n\r\n";
echo 
$request."<br><br>\r\n\r\n";
echo 
$ret;
?>
trravel is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump