Опубликовать на стене пользователя Facebook с помощью cURL PHP

Я храню токены пользователя и доступ к токенам. Могу ли я отправить на стену выбранного пользователя эту информацию? Следующий код можно найти здесь: http://developers.facebook.com/docs/reference/api/post/ Я просто не уверен, как запустить его с помощью php.

curl -F 'access_token=$accessToken' \ -F 'message=Check out this funny article' \ -F 'link=http://www.example.com/article.html' \ https://graph.facebook.com/$facebookid/feed 

 $attachment = array( 'access_token' => $token, 'message' => $msg, 'name' => $title, 'link' => $uri, 'description' => $desc, 'picture'=>$pic, 'actions' => json_encode(array('name' => $action_name,'link' => $action_link)) ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/fbnameorid/feed'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output $result = curl_exec($ch); curl_close ($ch); 

Я попробовал метод cURL, но не знаю, как должно быть $ action_name и $ action_link.

 <?php require_once("facebooksdk/facebook.php"); require_once('config.php'); $facebook = new Facebook(array( 'appId' => $appId, 'secret' => $appSecret, 'cookie' => true )); $access_token = $facebook->getAccessToken(); echo $access_token; $msg = "testmsg"; $title = "testt"; $uri = "http://somesite.com"; $desc = "testd"; $pic = "http://img.ruphp.com/php/d18eea9d28f3490b8dcbfa9e38f8336e.jpg"; $attachment = array( 'access_token' => $access_token, 'message' => $msg, 'name' => $title, 'link' => $uri, 'description' => $desc, 'picture'=>$pic, 'actions' => json_encode(array('name' => $action_name,'link' => $action_link)) ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/me/feed'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output $result = curl_exec($ch); curl_close ($ch); ?> 

Я успешно использую токен доступа, поэтому мне нужны только эти 2 параметра.

Используйте Facebook SDK . Это намного лучше, чем обработка CURL.