Problems by uploading Photo to album by Facebook API - PHP

前端 未结 2 1110
-上瘾入骨i
-上瘾入骨i 2021-01-22 11:18

I have problems to upload a photo to an album by the facebook API. this is my code.

$facebook->setFileUploadSupport(true);

    //Create an album         


        
2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-22 11:35

        $user = $this->facebook->getUser();
            $this->facebook->setFileUploadSupport(true);
            $user_profile = $this->facebook->api('/me');
            $album_details = array(
                'message' => 'Hello everybody this is me ' . $user_profile['name'],
                'name' => 'I am so slim because I dont have money to eat....:('
            );
            $create_album = $this->facebook->api('/me/albums', 'post', $album_details);
    
    // Upload a picture
            $photo_details = array(
                'message' => 'I am so slim because I dont have money to eat....:('
            );
            $photo_details['image'] = '@' . realpath('./a.jpg');
            $upload_photo = $this->facebook->api('/' . $create_album['id'] . '/photos', 'post', $photo_details);
    

    Please use $facebook on $this->facebook

提交回复
热议问题