简体   繁体   English

使用图形api和php获取大型Facebook页面个人资料图片

[英]Get large Facebook page profile picture using graph api & php

I'm trying to get large page profile picture using graph api and php, and I did it the following way: 我正在尝试使用图形api和php获取大页面配置文件图片,我按以下方式做到:

$getBigImage = get_headers('https://graph.facebook.com/'.$PID.'/picture?type=large&access_token='.$this->token.'',1);
$data['fbBigImage'] = $getBigImage['Location'];

My problem starts when I get sometimes error of: 当我偶尔得到错误时,我的问题开始了:

[13-Sep-2015 08:19:37 America/New_York] PHP Warning:  get_headers(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in line 252
[13-Sep-2015 08:19:37 America/New_York] PHP Warning:  get_headers(https://graph.facebook.com/1437355116498102/picture?type=large&access_token=***): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in line 252

I need to use another way or good alternative to the get_headers since it's sometimes fails (most of the times it works, but I need something to work with 100% of the cases) 我需要使用get_headers的另一种方式或更好的替代方法,因为它有时会失败(大多数时候它都有效,但我需要一些东西来处理100%的情况)

Thank you! 谢谢!

Just to check whether it's a network problem or not, you could try running: 只是为了检查是否是网络问题,您可以尝试运行:

<?php print_r(get_headers('http://google.com'));

As Google is the international connectivity tester ( :P ) you can make sure if it's on the network or not. 由于Google是国际连接测试人员(:P),您可以确定它是否在网络上。

Also, do you use some proxy? 另外,你使用一些代理吗? (If yes) Is it set up on the system or in each browser? (如果是)是在系统上还是在每个浏览器中设置?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM