我正在尝试抓取正在张贴到此页面墙上的照片。下面是我的代码:
include_once 'facebook.php';
include_once 'config.php';
require 'DropboxUploader.php';
$feed = $facebook->api('/me/feed');
foreach($feed['data'] as $feeds)
{
if(!$feeds["object_id"]==null)
{
echo "Feeds secion", "<br />";
echo $feeds["picture"], "<br />";
echo "<img src='{$feeds['picture']}' />", "<br />";
//echo "This is feed object_id ".$feeds["object_id"], "<br />";
echo "This is feed id ".$feeds["id"], "<br />";
$target_path = "uploads/";
$target_path = $target_path . basename($feeds["picture"]);
$content = file_get_contents($feeds["source"]);
file_put_contents($target_path, $content);
$uploader = new DropboxUploader('testing@hotmail.com', 'testing');
$uploader->upload($target_path, 'imageStore');
}
}我能够抓取图片,这是该图像的缩略图。我想问一下,我如何才能抓取实际的照片源本身,而不是缩略图。
请给我一些建议。谢谢!
发布于 2011-03-09 17:05:58
经过一些尝试和检查,我想我没有办法从facebook的墙上抓取真正的照片,因为它们都是预览缩略图。
我在这个问题上采取了另一种方法。当一张照片被张贴到墙上时,faceboook会自动创建一个相册“墙壁照片”(如果文件夹不存在),并将照片放在里面。我使用这个理论来获取相册id和里面的所有照片。
$album = $facebook->api('/'.$app_id.'/albums');
foreach($album['data'] as $photo)
{
if($photo['name']=="Wall Photos")
{
$image = $facebook->api('/'.$photo['id'].'/photos');
photoGrab($image); //function
}
}//each of $album foreach这不是一种很理想的思维方式。如果有更好更有效的方法,请告诉我。
谢谢!
https://stackoverflow.com/questions/5240276
复制相似问题