Get a large Facebook page profile image using api & php chart

I am trying to get a profile picture of a page using the api and php graph, and I did it like this:

$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 sometimes get an error:

[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 method or a good alternative to get_headers, as it sometimes fails (in most cases it works, but I need to work something with 100% of cases)

Thanks!

+4
source share
1 answer

To check if this is a network problem, you can try:

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

Since Google is an international connection tester (: P), you can make sure that it is online or not.

, ? ( ) ?

0

Source: https://habr.com/ru/post/1607153/


All Articles