0

我使用下面的代码在用户墙中发布,没有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;

?>
4

1 回答 1

0

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

 <?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);

?>
于 2012-10-02T20:48:46.547 回答