0

听到是我的代码。我想用 api php facebook 获取图片。变量 $photo 返回 NULL 值。

<?php
    $profile = $facebook->api('/<idfacebook>');
    $photo = $facebook->api('/'.$profile['username'].'/picture');
?>
4

1 回答 1

1

来自stackoverflow.com/questions/2821061

“只需通过以下网址获取数据:http: //graph.facebook.com/sarfraz.anees/picture

将 sarfraz.anees(我的名字)替换为您想要获取照片的用户名。您可以使用 PHP 的file_get_contents函数来读取该 url 并处理检索到的数据。

资源:http://developers.facebook.com/docs/api

注意:在 php.ini 中,您需要确保打开 openssl 扩展以使用file_get_contentsPHP 的功能读取该 url。"

于 2012-06-15T14:48:48.760 回答