facebook graph api - auto share links using php curl -
facebook graph api - auto share links using php curl -
i want auto share links in facebook wall using 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 began worked me after trying 7 times or more got error :
{ "error": { "message": "(#100) parameter url required", "type": "oauthexception", "code": 100 } } how can prepare it
links
create
you can post link on user's behalf issuing http post request profile_id/feed publish_stream permissions.
the other fields taken metadata of page url given in 'link' param.
if create successful, next return.
refer to: https://developers.facebook.com/docs/reference/api/user/#links
curl_setopt($ch, curlopt_url, 'https://graph.facebook.com/me/feed'); php facebook-graph-api
Comments
Post a Comment