我创建了一个 facebook 应用程序,它创建为新图像并将其上传到用户相册,但是当他们使用该应用程序时,该图像正在上传到我的相册。这听起来很有趣,但令我震惊的是,他们的图像怎么能上传给我。如果我犯了任何错误,请检查我的代码。
$access_token = 'ABCDEFGHIJKLMN';
$graph_url = "https://graph.facebook.com/me/albums?"
. "access_token=". $access_token;
$album_name = 'Klu report';
$postdata = http_build_query(
array(
'name' => $album_name,
'message' => 'sai ram'
)
);
$opts = array('http' =>
array(
'method'=> 'POST',
'header'=>
'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = json_decode(file_get_contents($graph_url, false,
$context));
$album_id = $result->id;
$graph_url= "https://graph.facebook.com/"
. $album_id ."/photos?"
. "url=" . urlencode('https://yourkishore.com/facebook/'.$output)
. "&message=" . urlencode('I got my Placements report get yours here : https://apps.facebook.com/yourkishore')
. "&method=POST"
. "&access_token=" .$access_token;
echo '<html><body>';
file_get_contents($graph_url);
echo '</body></html>';