Facebook:在没有SDK的用户墙中发布

Facebook:在没有SDK的用户墙中发布,facebook,facebook-graph-api,curl,Facebook,Facebook Graph Api,Curl,我用下面的代码在用户墙上发帖,没有SDK,发帖成功,但没有返回帖子id,请帮帮我 <?php $token=$_GET['token']; $id=$_GET['id']; $msg = "wooow thats soo possible"; $url = "https://graph.facebook.com/".$id."/feed"; $attachment = array( 'access_token' => $token, 'message' => $msg);

我用下面的代码在用户墙上发帖,没有SDK,发帖成功,但没有返回帖子id,请帮帮我

<?php
$token=$_GET['token'];
$id=$_GET['id'];

$msg = "wooow thats soo possible";
$url = "https://graph.facebook.com/".$id."/feed";
$attachment =  array(
'access_token' => $token,
'message' => $msg);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
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);
return $result;

?>

我得到了解决方案,下面的代码是有效的

 <?php
$token=$_GET['token'];
$id=$_GET['id'];

 $url = "https://graph.facebook.com/".$id."/feed";
    $ch = curl_init();
    $attachment =  array(   'access_token'  => $token,                        
                        'message'          => "cool winne"
                    );

    curl_setopt($ch, CURLOPT_URL,$url);
    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);
    $result= curl_exec($ch);

    curl_close ($ch);

?>


为什么不想使用php sdk?我使用的是某种服务器,无法上传所有文件,!!所以,请帮助我使用curl.php,你将如何上传这个文件?vi test.php,然后将这个代码粘贴到ssh:Pif中,如果你有ssh访问权限,那么你可以上传任何东西。了解scp