I created an app for my website, set action (read) and object (article), and placed the objects code (META tags in the head) at the article page on my website.
Now, I want to know how to send a cUrl request whenever a user reads an article on my website, so it’ll feature on his wall.
When I press the “get code” link near the action, that’s what I get:
curl -F 'access_token=***' \ -F 'article=http://example.com' \ 'https://graph.facebook.com/me/yellowheart:read'
(There’s an actual access token of course).
Now, how do I make it happen?
Using the PHP SDK you would use the api method.
$config = array(); $config['appId'] = 'YOUR_APP_ID'; $config['secret'] = 'YOUR_APP_SECRET'; $facebook = new Facebook($config); ... $facebook->api('https://graph.facebook.com/me/yellowheart:read? article=http://example.com'','POST');
You could also do a raw request
$myurl = 'https://graph.facebook.com/me/yellowheart:read? article=http://example.com&access_token=ACCESS_TOKEN&method=post'; $result = file_get_contents($myurl);
$facebook->api('/me/'.FB_NAME_SPACE.':action','POST', array('facility'=>'http://www.mysite.com/object?id=1') );
I followed the tutorial “Recipe Box” and found out how to “make it happen” in there step by step. Hope that helps in some way.