I am trying to connect to an API with an XML response. I have it working in json (see below) but i need it to return in xml instead.
//check if you have curl loaded
if(!function_exists("curl_init")) die("cURL extension is not installed");
$url = 'http://api.klout.com/1/klout.xml?users=username&key=keyhere';
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$r=curl_exec($ch);
curl_close($ch);
$arr = json_decode($r,true);
foreach($arr['users'] as $val)
{
echo $val['kscore'].'<br>';
echo $val['twitter_screen_name'].'<br>';
}
Thanks.
Chris