如何在 php 中将图像发布到 Facebook 事件?

发布于 2024-10-20 04:40:40 字数 630 浏览 0 评论 0原文

这是我的代码,

$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_info['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";

除了图像之外的所有内容都是发布的,我想使用事件图像创建事件。

怎么做呢?

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_info['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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

許願樹丅啲祈禱 2024-10-27 04:40:40

您正在寻找以下内容:

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文