例如,我在我的網站上安裝了WordPress。我想通過網址在Facebook上上傳圖片。我的形象鏈接:Facebook - 如何通過URL上傳照片?
http://example.com/wp-content/abc123.jpg
現在,我想通過自己的網站直接上傳到Facebook這個圖像到特定專集。我完全是N00B!所以不知道編碼的任何內容..
我的目標是創建一個封面網站。
* 第二次更新 *: 這裏是我使用的是現在的代碼:
<?php
$app_id = "12354";
$app_secret = "1213243434";
$post_login_url = "http://example.com/sdsds";
$album_id = "1234224";
$photo_url = "http://example.coom/test.jpg";
$photo_caption = "my caption";
$code = $_REQUEST["code"];
//Obtain the access_token with publish_stream permission
if (!$code){
$dialog_url= "http://www.facebook.com/dialog/oauth?"
. "client_id=" . $app_id
. "&redirect_uri=" . urlencode($post_login_url)
. "&scope=publish_stream";
echo("<script>top.location.href='" . $dialog_url
. "'</script>");
} else {
$token_url="https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id
. "&client_secret=" . $app_secret
. "&redirect_uri=" . urlencode($post_login_url)
. "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$access_token = $params['access_token'];
// POST to Graph API endpoint to upload photos
$graph_url= "https://graph.facebook.com/"
. $album_id . "/photos?"
. "url=" . urlencode($photo_url)
. "&message=" . urlencode($photo_caption)
. "&method=POST"
. "&access_token=" .$access_token;
echo '<html><body>';
echo file_get_contents($graph_url);
echo '</body></html>';
}
?>
所以從這個代碼,我能夠「test.jpg放在」上傳到Facebook,但現在問題是我不想只上傳一張圖片,我想上傳很多圖片,所以我不想改變「$ photo_url =」http://example.coom/test.jpg「;」這個代碼的新照片任何幫助將不勝感激!
這是一個幫助網站,而不是「我們只是給你的代碼」網站。我建議你看看http://developers.facebook.com網站,特別是https://developers.facebook.com/docs/reference/api/photo/ – TommyBs 2012-03-22 07:56:15
最重要的是,這個帖子https:/ /developers.facebook。com/blog/post/526 /應該有關於通過網址上傳的信息 – TommyBs 2012-03-22 08:03:34