php - Facebook api does not upload image -


my issue discussed here couldn't open file "" error in facebook php api

and php script is

//variables going post facebook $fbpermissions = 'publish_stream,user_photos';  //required facebook permissions $piclocation = 'fb_cover_images/cover7.jpg'; $msg_body = array(     'message' => 'i liked pic '. $homeurl .      ' perfect cover photo.',      'url' => "http://my_site.com/$piclocation" );  if ($fbuser){ //user logged in facebook, post our image   try {      $uploadphoto = $facebook->api('/me/photos', 'post', $msg_body );   }    catch (facebookapiexception $e) {     echo $e->getmessage(); //output error   } } else{   $loginurl = $facebook->getloginurl(   array('scope'=>$fbpermissions,'return_url'=>$return_url));   header('location: ' . $loginurl); } 

if set 'url' => "http://my_site.com/$piclocation" getting

(#200) permissions error

and if set 'url' => "@http://my_site.com/$piclocation" getting

couldn't open file "http://my_site.com/fb_cover_images/cover7.jpg"

message though if hit "http://my_site.com/fb_cover_images/cover7.jpg", can view image , permission folder+image set 777.

please guide doing wrong.... have searched fail.

i tried [php + facebook: how upload photo on wall? same rubbish message (#200) permissions error

also upload photo album facebook's graph api don't know hell going on fb api.

try adding following line top of code, after setting facebook:

$facebook->setfileuploadsupport( true ); 

then, change $msg_body following:

$msg_body = array(   'name' => 'i liked pic '. $homeurl . ' perfect cover photo.',   'source' => "http://my_site.com/$piclocation" ); 

the name caption image, , source url file. need prefix @ source if referencing local file.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -