phpfacebookpoststwitter-follow

PHP system posts, receive all of my friends posts on the page, like on facebook and twitter


Please, I need help, I'm creating a website, I want to put the system of followers, but I'm having trouble posting the system. I want the "index" of the site users see posts from your friends, but do not know to do this. Here's how I tried to do, I know what is wrong in this way, but I think it will help me understand.

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

//So it goes with every repitiendo "id" of my friends know what is wrong, please help me.

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

Solution

  • For Facebook you can use the FQL method https://developers.facebook.com/docs/reference/fql/ Check them and see what suits you. For example for artist information you do something like this:

    $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.
    }
    

    You can not use SELECT * in FB to get everything you need. You have to specify all that you need.

    Similarly for twitter, check https://dev.twitter.com/docs/api/1.1 . For example this gives the last 100 tweets of a person with that particular ID.

    $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));