Facebook PHP SDK: Upload Event Cover Photo

前端 未结 3 1205
面向向阳花
面向向阳花 2021-01-06 04:28

I use the facebook-php-sdk to create an event for a page.

Now as described here it is possible to upload a picture to an event.

The problem with that is, tha

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 05:19

    All answers above are wrong! There is only one way to create the Cover Image:

    Create The Event:

    $eventData = array(
        'name' => 'Event Title',
        'start_time' => 'StarttimeInCorrectFormat',
        'description' => 'Event Description'
    );
    $fbEvent = $fb->api('/PAGE_ID/events/', 'post', $eventData);
    

    Update the Event using the ID from above:

    $cover['cover_url']     = 'http://urlToCoverImage.jpg';
    $eventUpdate = $facebook->api( "/" . $fbEvent['id'], 'post', $cover );
    

    return true or false.

    And thats it. Cover is in.

提交回复
热议问题