我为我的网站创建了一个应用程序,设置了动作(读取)和对象(文章),并在我网站的文章页面上放置了对象代码(头部的Meta标签).
现在,我想知道当用户在我的网站上阅读文章时如何发送cUrl请求,因此它将在他的墙上发布.
- curl -F 'access_token=***' \
- -F 'article=http://example.com' \
- 'https://graph.facebook.com/me/yellowheart:read'@H_301_6@
(当然有一个实际的访问令牌).
现在,我该如何实现?
丹尼尔.
使用PHP SDK,您将使用
api方法.
- $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');@H_301_6@
你也可以做一个原始的请求
$myurl = 'https://graph.facebook.com/me/yellowheart:read? article=http://example.com&access_token=ACCESS_TOKEN&method=post'; $result = file_get_contents($myurl);@H_301_6@