views:

217

answers:

3

Hello.

I would like to know how to set my status using the Facebook Graph API and PHP, may be with the CURL function??

Thanks!!

A: 

http://developers.facebook.com/docs/api#publishing

curl -F 'access_token=...' \
     -F 'message=Hello, Arjun. I like this new API.' \
     https://graph.facebook.com/arjun/feed
Frank Farmer
Copying and pasting for the Facebook documentation isn't a good answer bro, but I already found the way to do it. What I needed was a piece of PHP code,,, as I say on my question, but thanks for the try.By the way, I wasn't able to do it by my self with the FB documentation because I believe is poor.
Jean Paul
Everything you need to know is right there. You POST two values: an access token and a the message you want to post. It really couldn't get any simpler.
Frank Farmer
+1  A: 

Using the new PHP SDK you can do:

<?php

require './facebook.php';

$fb = new Facebook(array(
  'appId'  => 'YOUR APP ID',
  'secret' => 'YOUR API SECRET',
  'cookie' => true, // enable optional cookie support
));
$post = $fb->api('me/feed', 'POST', array('message' => 'hello world!'));

The various parameters are documented at the bottom here.

daaku
A: 

Giving a try to what I found here:

Possible Solution

Seems to be the most razonable and simple solution.

Again, copying and pasting from Facebook documentation isn't giving an example, because their documentation it's not good as it should be, in other words, it's poor and the asume to many things.

Also thanks to you Daku.

The solution can be something like the post above:

$result = $facebook->api(
    '/me/feed/',
    'post',
    array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..')
);
Jean Paul

related questions