php - Facebook graph api photo upload to a fan page album -


I got the photo upload function to work with this code,

  & Lt;? Php include_once 'facebook-php-sdk / src / facebook.php'; Include_once 'config.php'; // This file is secret key and application id ... $ Facebook = new Facebook (array ('APPID' = & gt; FACEBOOK_APP_ID, 'secret' => FACEBOOK_SECRET_KEY, 'cookie' = & gt; true, Domain '= & gt;' your callback url goes here ')); $ Session = $ Facebook- & gt; GetSession (); If (! $ Session) {$ url = $ Facebook & gt; GetLoginUrl (request to permit necessary permissions here (array 'canvas' => 1, 'fbconnect' =>, 'req_perms' = & gt; 'user_photos, publish_stream, offline_access' // Here only Should work with publish_stream, but I added to protect others)); Echo 'you are not logged in, please & lt; A href = "'. $ Facebook- & gt; getLoginUrl ().' '& Gt; Login & lt; / a & gt; to access this app ;;} and try {$ uid = $ facebook- & Gt; getUser (); $ Me = $ facebook-> API ('/ m'); $ token = $ session ['access_token']; // here for me $ session $ album_id = ' Get the ID of: 1122 '; // Upload your photo $ file =' test.jpg '; $ Args = array (' message '=>' Photos from the app ',) $ $ AGR [Basename ($ file)] = '@' realpath ($ file); $ Ch = curl_init (); $ Url = 'https://graph.facebook.com/'.alalbum_id.'/photos?access_token=' $ Token; Curl_setopt ($ ch, CURLOPT_URL, $ url); Cur L_setopt ($ CH, CURLOPT_HEADER, incorrect); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ ch, CURLOPT_POST, true); Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ args); $ data = curl_xac ($ ch); // Returns the id of the photo you just uploaded print_r (json_decode ($ data, true)); hold (FacebookApiException $ e) {echo "error:" Print_r ($ E, true); }}? & Gt;  

I hope it helps, a friend and I have broken our head against the wall for some time to get this work done!

Anyway, this is my question, how can I upload an image to a fan page? I am struggling to get this work, when I upload an image, I have a photo ID but there is no photo in the album.

So basically, when the user clicks on the upload button on our application, then I need

How can anyone accomplish this?

This bug looks like a bug with API; see this (the link can not be posted, however )


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -