2013-07-26 42 views
0

請幫助,我正在創建一個網站,我想把關注者的系統,但我有麻煩張貼系統。 我想讓網站用戶的「索引」看到朋友的帖子,但不知道要這樣做。 以下是我試圖做的事,我知道這樣做有什麼問題,但我認爲這會幫助我理解。PHP系統的帖子,在頁面上收到我所有的朋友帖子,如在Facebook和Twitter上

*$result = mysqli_query($con,"SELECT * FROM posts WHERE userid='127' OR userid='2' ");` 

//如此這般每repitiendo朋友「ID」知道什麼是錯了,請幫助我。

while($row = mysqli_fetch_array($result)) { 
    echo $row['post'] . " " . $row['userid']; 
    echo "<br>"; 
}* 

回答

0

對於Facebook來說,你可以使用FQL方法https://developers.facebook.com/docs/reference/fql/ 檢查他們,看看有什麼適合你。例如,對於藝術家信息,您可以這樣做:

$fql = 'SELECT name,fan_count,page_id,hometown,record_label,pic_cover,pic_large,website from page WHERE type="musician/band" AND name="Rihanna"'; 
$ret_obj = $facebook->api(array('method' => 'fql.query','query' => $fql)); 
foreach ($ret_obj as $var) 
{ 
    //Get the information you need. 
} 

您不能在FB中使用SELECT *來獲取所需的所有內容。你必須指定所有你需要的。

同樣對於twitter,請檢查https://dev.twitter.com/docs/api/1.1。例如,這給出了具有該特定ID的人的最後100條推文。

$info=$twitter->request('https://api.twitter.com/1.1/statuses/user_timeline.json','GET',array('user_id'=>1234,'count'=>100,'contributer_details'=>true,'exclude_replies'=>true)); 
相關問題