1
我看說明書:Upload Photo To Album with Facebook's Graph API上傳圖片至Facebook通過使用curl PHP
不過,雖然我按照說明,該圖像不能被上傳到FB。這是我的代碼。請幫幫我。
$graph_url = "https://graph.facebook.com/". $album_id . "/photos?access_token=" . $access_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, $post_url);
$post_array = array(
"source" =>"@". realpath("photo.jpg"),
"message"=>"Upload " . date('Y-m-d h:i:s')
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
$response = curl_exec($ch);
$graph_url = "https://graph.facebook.com/". $album_id . "/photos?access_token=" . $access_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, $post_url);
$post_array = array(
"source" =>"@". realpath("photo.jpg"),
"message"=>"Upload " . date('Y-m-d h:i:s')
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
$response = curl_exec($ch);
嘗試 「的形象不能被上傳到FB」。爲什麼不?你有任何錯誤? – CodeCaster
你設法做到了嗎? – user3697768