开发者

how to post image to facebook events in php?

开发者 https://www.devze.com 2023-02-14 20:17 出处:网络
This is my code, $event_info[\'name\'] = $name2; $event_info[\'category\'] = 1; $event_info[\'privacy_type\'] = \'OPEN\';

This is my code,

$event_info['name'] = $name2;
$event_info['category'] = 1;
$event_info['privacy_type'] = 'OPEN';
$event_info['subcategory'] = 1;
$event_info['description'] = $description_new; //description for event
//$event_info['host'] = $desc; //description for event
//$event_info['host'] = 'You';
$event_in开发者_高级运维fo['location'] = $location;
$event_info['city'] = $city; //Must be a valid city name

$event_info['start_time'] = $newTime; //Converts time to UTC
$event_info['picture'] = "@http://static.eventful.com/images/small/I0-001/003/184/085-4.jpeg";

Everything is post except image , I want create event with event image.

How to do it?


Something along these lines is what your looking for:

$fname="/tmp/foo.jpg";
$attachment =  array(
        'access_token' => $facebook->getAccessToken(),
        'name' => '',
        'description' => '',
        'start_time' => '',
        'link' => '',
        'source'=> '@'.$fname
        /*...*/
);

/*Send the data*/
$result = $facebook->api('/me/events', 'POST', $attachment);
  • http://forum.developers.facebook.net/profile.php?id=138142
  • Facebook graph API & PHP SDK questions
0

精彩评论

暂无评论...
验证码 换一张
取 消