2017-06-01 11 views
0

で指定されたURLに対しては機能しません(両方とも私の開発コンピュータで、かつ当社の生産PHPサーバで)次のように私はPHPを使用してページをダウンロードし、それが動作します:PHPのカールは、指定したPHPサーバー

$url = "http://google.com/"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
$content = curl_exec($ch); 
curl_close($ch); 
echo strlen($content); 

しかし、 "https://invue.com/patents/"というURLの場合は、開発用コンピュータでのみ動作しますが、プロダクション用PHPサーバ(strlen($content)0)からは動作しません。

何が問題になるか、または問題を見つける方法を知りたいですか?カール失敗の

+0

何curl_error詳細についてはcurl_error

$url = "http://google.com/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $content = curl_exec($ch); // check, Did something go wrong !? if($content === false){ // This will show what's wrong. echo 'Curl error: ' . curl_error($ch); } curl_close($ch); echo strlen($content); 

機能を使用することができますか? –

+0

たくさんあります。おそらくあなたの生産のIPがブロックされている? – Nanne

+1

これを試してくださいif($ content === false){echo 'Curl error:'。 curl_error($ ch); } 'エラーがあれば。 – jagad89

答えて

1

、あなたはhttp://php.net/manual/en/function.error-reporting.phpから