hcker2000
hcker2000

Reputation: 615

PHP SDK - Post Image to facebook fan page

I have a file url (http://example.com/image.jpg) and I need to make an image post to a facebook fan page (already have the access token).

What is the best way to do this with the facebook PHP SDK?

It seams like I will need to some how load the image and then some how post it as multipart/form-data according to the api docs

Upvotes: 0

Views: 707

Answers (1)

C3roe
C3roe

Reputation: 96151

No, you can also use the parameter url with the publicly reachable HTTP address of your image, instead of the source parameter, and send it as a normal POST request. (Mentioned here in last sentence of introduction: developers.facebook.com/docs/reference/api/photo)

That seems to be info for postings to a users wall not a fan page. The docs differ fan pages.

It works for pages as well. And @filepath is for real HTTP POST uploads using cURL (explicitly or implicitly by using the FB PHP SDK). With the url parameter you just pass the value http://example.com/image.jpg, nothing else. (Apart from message, title, …)

Upvotes: 1

Related Questions