problems with curl :-S
Posted by: Ryo-ohki
Posted on: 2006-02-17 07:16:00
I'm trying to install a script to show the last few songs I've listened to. I haven't been able to use it sucessfully on my DH account because it uses file_get_contents and well I don't know how to use curl instead of that.
The original code is:
$xml = @file_get_contents(DEBUG===true ? 'aliguana.xml'
: 'http://ws.audioscrobbler.com/1.0/user/'.$user.'/recenttracks.xml');
I tried replacing that bit with the curl stuff but it just isn't working.
Here's what I have:
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://ws.audioscrobbler.com/1.0/user/'.$user.'/recenttracks.xml');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$xml = curl_exec($ch);
curl_close($ch);
// display file
echo $xml;
Any help would be vastly appreciated. The original script and instructions can be found at http://www.audioscrobbler.net/wiki/RecentlyPlayedImageV2 and it's the RPI.php file I'm trying to change.
The Insane Cabbit
My Blog http://www.sounanda.com
My web store:
http://www.marciesgifts.com
Send me a pm if you want cms or forum software installed (for a fee)