PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, December 28, 2021

[FIXED] Post message with picture to facebook page/feed using graph api

 December 28, 2021     facebook, facebook-graph-api, facebook-php-sdk, php     No comments   

Issue

I'm trying post an a message with one image via facebook graph API, and I can't. In new documentation https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed there is no field for an image.

If I try to use a field "object_attachment", only small thumbnail appears and post is styling like a share link.

If I try to use a field "picture", and use url of photo in the internet there is the same result. I can't post "picture" from local,as here:

$post['picture'] = '@' . realpath($image);

error appears: "picture URL is not properly formatted".

I just used a free web app to make a post with a photo, and result is just right(see attached image)

Please tell me, how can I make a post with the exact result?

enter image description here


Solution

if you want to post a photo to FB (i.e. in to the Albums) and a text and publish both on the timeline, you need to upload the photo to FB. Not as an attachment with an external URL, but as binary data send to FB.

Have a look at

     https://graph.facebook.com/<user id>/photos

and within that field source



Answered By - Axel Amthor
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing