Robert Isaev
Robert Isaev

Reputation: 121

Facebook Open Graph PHP SDK event picture

I have a problem with adding picture to the FB event. To create event I use FB PHP SDK.

here is the code:

$fb_config = array(
  'appId' => 'xxx',
  'secret' => 'xxx',
  'fileUpload' => true
);

$facebook = new Facebook( $fb_config );
$facebook->setFileUploadSupport(true);
$access_token = get_option( 'facebook_token' );
$facebook->setAccessToken( $access_token );

$eventInfo = array(
  'fields'=>'name,picture,start_time,description',
  'name'          => 'Event name',
  'start_time' => 'Start Date',
  'end_time' => 'End Date',
  'description'   => 'Event Desc',
  'picture' => 'http:// link to the image on the same server as provided on the app conf page.'
);

$result = $facebook->api(
  '/fb_page_id/events',
  'post',
  $eventInfo
);

print_r($result); // {id: fb_event_id }

with this code event creates fine, but picture of the event is missing. When I use Facebook Graph Api explorer tool with the same fields, picture is missing too.

thanks for your help!

Upvotes: 0

Views: 707

Answers (1)

Hammad Haleem
Hammad Haleem

Reputation: 1394

Uploading a picture to facebook

try posting via curl , it would work !

plus it may be that your application is not having , publish_stream permission

http://developers.facebook.com/docs/reference/api/photo/

read the available options here ! http://developers.facebook.com/docs/reference/api/user/#events

Upvotes: 1

Related Questions