Question

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

Was it helpful?

Solution

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, …)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top