站长统计代码,做云教育集群网站,搜索百度app下载,免费推广的途径与原因我使用cUrl(php)以xml格式将项目代码发送到Web服务。我在localhost中得到正确的响应#xff0c;但是当它做服务器它显示cURL Error (7): couldn’t connect to host这里是我的代码#xff1a;function xml_post($post_xml, $url){$user_agent $_SERVER[HTTP_USER_AGENT];$ch…我使用cUrl(php)以xml格式将项目代码发送到Web服务。我在localhost中得到正确的响应但是当它做服务器它显示cURL Error (7): couldn’t connect to host这里是我的代码function xml_post($post_xml, $url){$user_agent $_SERVER[HTTP_USER_AGENT];$ch curl_init(); // initialize curl handlecurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_FAILONERROR, 1);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_TIMEOUT, 50);curl_setopt($ch, CURLOPT_POSTFIELDS, $post_xml);curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);// curl_setopt($ch, CURLOPT_PORT, $port);$data curl_exec($ch);$curl_errno curl_errno($ch);$curl_error curl_error($ch);if ($curl_errno 0) {echo cURL Error ($curl_errno): $curl_error\n;} else {echo Data received\n;}curl_close($ch);echo $data;}我将项目代码发送到计数器并从中获取详细信息。我试图使用版本php 4和php5没有工作任何解决方案。