簡體   English   中英

使用圖形api和php獲取大型Facebook頁面個人資料圖片

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

我正在嘗試使用圖形api和php獲取大頁面配置文件圖片,我按以下方式做到:

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

當我偶爾得到錯誤時,我的問題開始了:

[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

我需要使用get_headers的另一種方式或更好的替代方法,因為它有時會失敗(大多數時候它都有效,但我需要一些東西來處理100%的情況)

謝謝!

只是為了檢查是否是網絡問題,您可以嘗試運行:

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

由於Google是國際連接測試人員(:P),您可以確定它是否在網絡上。

另外,你使用一些代理嗎? (如果是)是在系統上還是在每個瀏覽器中設置?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM