Note that there are some explanatory texts on larger screens.

plurals
  1. POUpload photo to a fan page as a user (not admin)
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/10912901/posting-photo-to-facebook-fan-page-via-ios-app-by-regular-non-admin-users">Posting Photo to facebook fan page via iOS app by regular non-admin users</a> </p> </blockquote> <p>If I use the fan page id instead of uid, it will be uploaded to my own profile. I think it is due to an access token error. When I install it to the fan page, it returns a picture id, but i cannot find it anywhere - very interesting. Is there a way to accomplish what I am trying to do ?</p> <p>Here is what I have attempted so far,</p> <pre><code> $uid = $facebook-&gt;getUser(); $token = $session['access_token']; //here I get the token from the $session array $album_id = '35465'; $pageid="170319849651932"; /* Tried to work with likes (after accounts..) but returns not access token $likes = $facebook-&gt;api('/me/likes'); foreach($likes['data'] as $like) if($like['id'] == $pageid) { // the one we are looking for $token = $like['access_token']; } */ //upload your photo $file= 'fight_club_020.jpg'; $args = array( 'message' =&gt; "$uid", ); $args[basename($file)] = '@' . realpath($file); $ch = curl_init(); $url = 'https://graph.facebook.com/'.$pageid.'/photos?access_token='.$token; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $args); $data = curl_exec($ch); $szam=json_decode($data,true); } $photo = $facebook-&gt;api($szam[id]); print_r($photo); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload