0
我想在php中編寫一些代碼,以便在某個網站上顯示某個特定網址在推特上的推文次數。來自Twitter API的調用數據
我假設我使用此頁面中的信息; http://api.tweetmeme.com/url_info?url=http://dori.co.nz/
但是我需要添加哪些代碼才能將這些值添加到Wordpress主題的標題中?
非常感謝提前!
我想在php中編寫一些代碼,以便在某個網站上顯示某個特定網址在推特上的推文次數。來自Twitter API的調用數據
我假設我使用此頁面中的信息; http://api.tweetmeme.com/url_info?url=http://dori.co.nz/
但是我需要添加哪些代碼才能將這些值添加到Wordpress主題的標題中?
非常感謝提前!
<?php
$url = "http://api.tweetmeme.com/url_info?url=http://dori.co.nz/";
$test = file_get_contents($url);
$xml = simplexml_load_string($test);
echo $xml->story->url_count;
?>
在這裏,我們走了。
非常感謝你! – Adam
http://www.w3schools.com/php/php_xml_simplexml.asp這將有助於你.. – zaw
謝謝,我讀過,但我不能釘它。這是我到目前爲止... – Adam
<? $ url =「http://api.tweetmeme.com/url_info?url=http://dori.co.nz/」; $ xml = file_get_contents($ url); $ xml = simplexml_load_string($ xml); $ shares = $ xml-> result-> story-> url_count; echo $ shares; ?> – Adam