日期:2014-05-16  浏览次数:20625 次

curl数据提交 在nginx中出错
请问: 
curl方法数据提交,在apache服务器运行,没有任何问题。 
在nginx服务中,curl_exec($ch)执行结果为false,且只有等到timeout后,该php才会停止执行,否则一直处于刷新状态。 

nginx.conf该怎么配置,才能解决此问题。 谢谢 

<?php
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,'http://192.168.247.138:8181/a2.php'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$data = curl_exec($ch); 
curl_close($ch); 
var_dump($data);
?>
------解决方案--------------------
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,'http://192.168.247.138:8181/a2.php'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$data = curl_exec($ch); 
var_dump($data);
curl_close($ch);