简体   繁体   中英

Publishing a post on users' wall by facebook app

I need to generate a picture from facebook user profile picture and post it to some users' walls. For instance, $attch = array( 'media' => array((array('type' => 'image', 'src' => ' https://graph.facebook.com/ '.$uid.'/picture',
'href' => ' https://graph.facebook.com/ '.$uid.'/picture/')));

'src' => ' https://graph.facebook.com/ '.$uid.'/picture' line doesn't show any picture...

How can I resolve this?

Thanks

I answered this in your duplicate question .

It's not showing a picture because there's nothing at https://graph.facebook.com/[user id]/picture. You need to query https://graph.facebook.com/[user id] and parse the JSON to get its URL.

You are going to the right place for the picture:

http://graph.facebook.com/[username or id]/picture/ returns a redirect to the image on Facebook's CDN.

You can try it in a browser.

I don't know what you're doing with that array but the likely problem with your code is that you are not following the redirect to find the actual image.

The image that the picture URL redirects to can change over time so you should always go to it first and follow the redirect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM