日期:2014-05-17 浏览次数:20746 次
//发送post请求 function _xpost($url,$p) { $f=''; $data=''; foreach($p as $k=>$v) { $data.=$f.$k.'='.urlencode($v); //$data.=$f.$k.'='.$v; $f='&'; } //echo $data.'</br>'; $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; }