在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
function RequestPOST($url, $paraArray, $timeout = 0) { $curl = curl_init(); $timeout = $timeout==0?100:$timeout; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //对HTTPS时 不校验证书 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($curl, CURLOPT_POSTFIELDS, $paraArray); curl_setopt($curl, CURLOPT_HTTPHEADER, arry( 'Content-type: text/plain', //传递格式 'Content-length: 100' )); $output = curl_exec($curl); $error = curl_error($curl); $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if($code == '200') { // 成功返回 $ret = json_decode($output, true); }else { } return $ret; } PHP的curl使用方法 |
2022-07-18
2022-08-30
2022-08-17
2022-11-06
2022-08-17
请发表评论