Change script to Curl



I have a script that needs to be changed from “file_get_contents” to CURL.

Can anyone help me with this? I’m a noob in PHP so any help would be appreciated.

My script;

$stream_url = “”;
$xspf_url = $stream_url . “.xspf”;
$xml = file_get_contents($xspf_url);
$data = simplexml_load_string($xml);
// Track artist
print $data->trackList->track->creator;
// Track title
print $data->trackList->track->title;



Well that isn’t helpful at all…

i think it is something like this…

function getXSPF(){ $XSPFurl = ‘'; $xml = simplexml_load_file($XSPFurl); $stream[‘info’][‘title’] = (string) $xml->trackList->track->title; $stream[‘info’][‘location’] = (string) $xml->trackList->track->location;
preg_match_all('/^(.*):(.*)/m', (string) $xml->trackList->track->annotation,$matches);
if(isset($matches[1]) && isset($matches[2])){
    $t = array_combine($matches[1], $matches[2]);
    foreach($t as $key => $val){
        $fkey = str_replace(" ", "_",$key);
        $stream['info'][strtolower($fkey)] = trim($val);
return $stream;


But this aint working


Do you want cURL or not? That is how you make a cURL request, which is what you stated you were after.