0
我刚刚编码Twitter饲料为我的状态获取XML。我想知道是否有任何链接也为XML的提及和#标签Twitter的XML饲料
我刚刚编码Twitter饲料为我的状态获取XML。我想知道是否有任何链接也为XML的提及和#标签Twitter的XML饲料
Twitter并提到:
function curlRequest($url, $post) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERPWD, "username:password");
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
// we are not using the $post variable yet, but stay tuned!
if ($post) {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
}
return curl_exec($curl);
}
//then call this function as:
$contents= curlRequest(“http://twitter.com/statuses/mentions.xml”, FALSE);
$xml= new SimpleXMLElement($contents);
foreach($xml->status as $status) {
echo "<li>$status->text</li>";
}
关于这个主题标签已经在这里找到答案:http://stackoverflow.com/questions/2714471/ twitter-api-display-all-tweet-with-a-certain-hashtag – 2012-02-01 06:24:20
谢谢,但我宁愿用cURL – 2012-02-02 02:55:45