How to upload a picture for an event using the Facebook Graph API?

后端 未结 5 1937
慢半拍i
慢半拍i 2021-02-03 11:33

I would like to know how to add a picture to an event using the Facebook Graph API. I have seen this question and tried some variations on that theme, without any success. The o

5条回答
  •  鱼传尺愫
    2021-02-03 12:16

    I had the same problem, this code work for me:

    // create the event
    // ...
    
    // upload the picture
    $file = "pathtothefile";
    $args[basename($file)] = '@' . realpath($file);
    $data = $facebook->api('/'. $event_id, 'post', $args);
    

    But sometimes I get "(#324) Missing or invalid image file" error

提交回复
热议问题