2013-02-19 162 views
0

我正在使用php sdk將圖片上傳到facebook相冊。爲此我需要給出我的服務器的Images.Incase的真實路徑我可以給圖片的真實路徑並上傳到Facebook工作正常。但在這裏我想通過使用外部圖像URL將圖像上傳到Facebook相冊。 即,我想通過使用下面的圖像URL將圖像上傳到fb。 http://i.nokia.com/r/image/view/-/2003984/highRes/2/-/Lumia-620-Smart-Shoot.jpg從php中獲取文件路徑?

$this->facebook->setFileUploadSupport(TRUE); 

      $photo = $this->facebook->api('/*********/photos', 'POST', array(
         'access_token' => $this->config->item('facebook_page_access_token'), 
         'source' => '@' .$imagePath, 
         'message' => "description text" 
         ) 
     ); 

這是我上傳圖片到FB的代碼。 這裏如何通過使用PHP中的給定URL來獲取圖像的路徑?

回答

1

您可以使用'url'參數從外部來源發佈照片。

$photo = $this->facebook->api('/*********/photos', 'POST', array(
     'access_token' => $this->config->item('facebook_page_access_token'), 
     'url' => $imagePath, 
     'message' => "description text" 
     ) 
); 

簽出下面的文件。

https://developers.facebook.com/docs/reference/api/photo/

+0

謝謝你的回答 – shihabudheen 2013-02-19 08:35:11