Wednesday, May 16, 2012

Extracting info from Twitter XML to Wordpress

I'm wanting to use raw data from Facebook and Twitter on my website. I've worked out extracting data from the Facebook XML (with help from a nice bloke) and I've installed a nice slider thing. Here is the details of that...



$url = "http://api.facebook.com/restserver.php?method=links.getStats&urls=www.dori.co.nz".urlencode($source_url);

$xml = file_get_contents($url);
$xml = simplexml_load_string($xml);
$shares = $xml->link_stat->share_count;
$likes = $xml->link_stat->like_count;
$comments = $xml->link_stat->comment_count;
$total = $xml->link_stat->total_count;
$max = max($shares,$likes,$comments);


Now I want to do the same for Twitter. Here is the XML page for Twitter, but I can't seem to make it work no matter what I do. Any tips? Is there an issue with plucking details from two different XML pages/files within the one .php file?



Thank you!!





No comments:

Post a Comment