-1

我在 Facebook 上的活动墙上发布图片时遇到问题。它正在发布

我目前的代码是:

$post_array = array(
    "access_token" => $facebook->getAccessToken(),
    'source' => "@" . realpath("image.png"),
    'message' => 'Some Message'
);
$post_id = $facebook->api("/".$event_id['id']."/feed", "POST", $post_array);

一切正常,除了图像:它不会显示。

有什么帮助吗?

4

1 回答 1

0

如果对于事件,请尝试:


//Setup the Facebook object for file upload
$facebook = new Facebook(array(
  'appId'  => 'your_app_id_here',
  'secret' => 'your_secret_here',
  'cookie' => true,
  'fileUpload' => true
));

然后:


$file = "image.png";
//The event information array (timestamps are "Facebook time"...)
$event_info = array(
    "access_token' => 'your access token",    
    "name" => "Event Title",    
    "start_time" => 1290790800,
    "end_time" => 1290799800,
    "location" => "Your Location",
    "description" => "Event Description"
);

$event_info[basename($file)] = '@' . realpath($file);

$result = $facebook->api('me/events','post',$event_info);

希望能帮助到你

于 2012-03-15T11:52:10.670 回答