开发者

Update facebook status using php

开发者 https://www.devze.com 2023-02-26 15:54 出处:网络
I know it\'s a very old question.But i really bound to ask the same question again.How can i update my status using PHP?Because i find several solutions in google and stackoverflow but non of that cur

I know it's a very old question.But i really bound to ask the same question again.How can i update my status using PHP?Because i find several solutions in google and stackoverflow but non of that currently works.May be the cause of facebook up gradation process or anything else. I chk: 1) http://360percents.com/posts/php-curl-status-update-working-example-sep-2010/ 2) http://www.barattalo.it/2010/03/01/php-curl-bot-to-update-facebook-status/

But unfortunately non of the solution is working.So, is their any kind heart who can help me to update the facebook 开发者_开发技巧status using php easily?i shall be very much glud if anybody pls give any working solution. Regards---riad


Well, I've wrote a tutorial about posting to the user's wall: How To: Post A Message On The User Wall Using Facebook Graph API.

$args = array(
    'message'   => 'Hello from my App!',
    'link'      => 'http://www.masteringapi.com/',
    'caption'   => 'Visit MasteringAPI.com For Facebook API Tutorials!'
);
$post_id = $facebook->api("/me/feed", "post", $args);

Notes:

  1. I'm using the PHP-SDK
  2. You need the publish_stream permission
  3. Check out this answer


What about checking directly the Facebook API ?

http://developers.facebook.com/docs/

Check the "Graph API"

The Graph API is the core of Facebook Platform, enabling you to read and write data to Facebook. It provides a simple and consistent view of the social graph, uniformly representing objects (like people, photos, events, and pages) and the connections between them (friendships, likes, and photo tags).


I wrote this code im my blog completely pl check that in the following link

http://scriptime.blogspot.in/2012/12/facebook-status-updates-using-php-sdk.html

here i am giving samll code

  $status      = $_POST['status'];
$facebook_id = $userdata['id'];
$params      = array(
    'access_token' => $access_token,
    'message' => $status
);
$url         = "https://graph.facebook.com/$facebook_id/feed";
$ch          = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_POSTFIELDS => $params,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_VERBOSE => true
));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号