2012-02-01 2 views
0

XML을 가져 오는 내 상태에 대한 트위터 피드를 코딩했습니다. 거기에 어떤 링크가 XML은의 언급에 대해도 및 해시 태그 트위터Twitter XML 피드

+0

: http://stackoverflow.com/questions/2714471/ twitter-api-display-all-tweets-with-特定 해시 태그 –

+0

감사합니다.하지만 오히려 cURL과 함께 사용하십시오. –

답변

0

언급하는 경우 궁금 해서요 : 해시 태그이 이미 답이 여기있다에 대해서

 

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>"; 
}