cURL을 사용하여 페이스 북 페이지에 액세스하고 있습니다. 로컬로 그것은 완벽하게 작동하지만, 내 dev에 서버에 업로드하면, 그것은 휴식과 빈 문자열을 반환합니다. 확인한 후 cURL이 서버에 설치되었습니다. 다음은 Facebook에 액세스 할 때 사용하는 코드입니다.cURL 및 Facebook 문제
$header = array();
$header[] = 'Accept: text/json';
$header[] = 'Cache-Control: max-age=0';
$header[] = 'Connection: keep-alive';
$header[] = 'Keep-Alive: 300';
$header[] = 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7';
$header[] = 'Accept-Language: en-us,en;q=0.5';
$header[] = 'Pragma: ';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://facebook.com/feeds/page.php?format=json&id=135137236003');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close ($ch);
도움이 되었습니까?
php_curl 사용할 수 있습니까? echo phpinfo()로 찾을 수 있으며 curl이 없으면 curl이라는 단어를 찾습니다. – Venu
yes curl이 활성화되어 있습니다. – jasonaburton
다른 페이지를 컬링하여 서버와 페이스 북 사이에 문제가 있는지 여부를 판단 해 보셨습니까? –