使用curl报couldn't connect to host错误
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->//发送post请求 function _xpost($url,$p) { $f=''; $data=''; foreach($p as $k=>$v) { $data.=$f.$k.'='.urlencode($v); //$data.=$f.$k.'='.$v; $f='&'; } //echo $data.''; $curl = curl_init($url); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $res = curl_exec($curl); if(curl_errno($curl)) { echo 'Curl error: ' . curl_error($curl); } curl_close($curl); return $res; }