2

I want to auto share links in my facebook wall using this script :

   $attachment =  array(
    'email' => 'mail',
    'password' => 'password',
    'access_token' => 'my token',
    'message' => "my message",
    'name' => 'name',
    'link' => 'my_url',
    'description' => "my description"
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/links');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,5);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.001 (windows; U; NT4.0;    en-US; rv:1.0) Gecko/25250101');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    $json = json_decode($result);
    $post_id = $json->{'id'};
    curl_close($ch);

at the began it worked for me but after trying it for 7 times or more i got this error :

{ "error": { "message": "(#100) The parameter url is required", "type": "OAuthException", "code": 100 } } 

how can I fix it

4

1 回答 1

1

链接

创造

您可以通过向具有权限的PROFILE_ID/feed发出 HTTP POST 请求,代表用户发布链接。publish_stream

其他字段取自“链接”参数中给出的页面 URL 的元数据。

如果创建成功,会得到如下返回。

参考:https ://developers.facebook.com/docs/reference/api/user/#links

curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed');
于 2013-02-11T02:49:42.600 回答