Picture posting NOT working with facebook Graph AP

2019-01-15 09:30发布

问题:

Picture posting NOT working with Facebook Graph API

The message is posted but the picture is NOT.

I am using the Graph API to post to the wall on Facebook.

My code was working fine posting the picture but is NOT posting picture anymore!

Here are the CURL parameters:

I am posting to URL: https://graph.facebook.com/ID/feed

and the POST parameters are:

access_token=TheToken&message=My+Message&picture=ImgUrl

where: access_token is a valid access token message is the message to display on the wall picture is the image associated with the message to display on the wall

The ID is valid and access_token is valid.

Any help is appreciated, Facebook seems to be notorious in changing their API without informing interfacing sites!

回答1:

I had the same problem when posting using the graph api via PHP. Dont know what the cause what, but my image URLs contained a - sign (http://the.url/to/the-image.jpg). After renaming the images, everything worked as expected.

What is your image url?



回答2:

I used the LINK parameter instead of the PICTURE parameter and all seems to be working now. Facebook changed something in regards to the PICTURE parameter where it stopped working. I did NOT change any code on my system and it just stopped working. See http://developers.facebook.com/docs/reference/api/post/



回答3:

Ken, but what if you want link= to point to something else? this works:

curl -F \
     "picture=http://tycho.usno.navy.mil/gif/moons/m146.gif" \
     -F "message=you're looking great tonight!" \
     -F "name=Current Moon Phase" \
     -F "link=http://www.calculatorcat.com/moon_phases/phasenow.php" -F caption="How the moon appears tonight" \
     -F "access_token=111111111111111|2222222222222222222222222|33333333333333333333456n" \
     "https://graph.facebook.com/215958041750734/feed"

you can see result at: https://www.facebook.com/pages/The-Moon/215958041750734



回答4:

works for me using source parameter:

$graph_url= "https://graph.facebook.com/me/feed?"
          . "source=" . urlencode($_POST["picture"])
          . "&link=" . urlencode($_POST["link"])
          . "&message=" . urlencode($_POST['message'])
          . "&method=POST"
          . "&access_token=" .$access_token;
$response=file_get_contents($graph_url);
$json=json_decode($response);


回答5:

Posting picture works for me but somehow including a source (swf) causes the picture to not display anymore. This used to work until last week.



回答6:

Wait for it

I noticed that it takes more time for Facebook to process the picture (up to 15 minutes) than to post the link on the timeline (instant).