时间:2021-07-01 10:21:17 帮助过:8人阅读
//发送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; }