0
私はFacebookにアルバムに画像を投稿し、その画像に説明をつけようとしています。 イメージをアルバムにアップロードできますが、説明を追加できないようです。ここでFacebook Graph API:アップロードした画像にキャプションを追加するにはどうすればよいですか?
は、私が使用するコードです:
// prepare the curl post fields
$batch = sprintf('[{"method":"POST", "relative_url":"%1$s/photos", "attached_files":"file1", "message":"caption"}]', $album_id);
$post_fields = array(
'batch' => $batch,
'access_token' => $access_token,
'file1' => '@' . $image_abs_path,
'caption' => 'image caption goes here"
);
$uri = 'https://graph.facebook.com';
$curl = curl_init($uri);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
$raw_data = curl_exec($curl);
curl_close($curl);
$data = json_decode($raw_data, $assoc = TRUE);
私はまた、「名前」と呼ばれる後フィールドで試してみましたが、私はこれを使用するとき、私は結果として空の配列を取得します。このポストフィールドを使用すると、画像はアルバムに追加されません。
おかげで、お役に立てば幸いです。 – ThoDho