快递简单的实时查询API.PHP

释放双眼,带上耳机,听听看~!

<?php
/*

$res = curl_post($url,json_encode($postData),$header);
print_r($res);

function curl_post($url, $postData,$header=array(),$cookie_file=”,$isheader=0,$proxy=”,$debug=0,$autoRedirect=0,$time=89){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if(!empty($isheader)){
curl_setopt($ch, CURLOPT_HEADER, $isheader);
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT,$time);
curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows NT 5.1; rv:44.0) Gecko/20100101 Firefox/44.0’);
if(!empty($header)){
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
}

if(!empty($autoRedirect)){
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
}
if(!empty($cookie_file)){
    // 读取文件所储存的Cookie信息
    curl_setopt ( $ch, CURLOPT_COOKIEFILE, $cookie_file );
}
if(!empty($proxy)){
     curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
//curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
if(!empty($debug)){
     curl_setopt($ch,CURLOPT_VERBOSE,1);
     curl_setopt($ch,CURLOPT_FAILONERROR,TRUE);
     print_r(curl_error($ch));
     print_r(curl_getinfo($ch));
}
$html = curl_exec($ch);
curl_close($ch);
return $html;

}

【转自慕课】https://www.imooc.com

PHP

菜鸟总结正则表达式常见用法和思维导图

2022-3-3 12:41:14

PHP

php求差集的几种方法。

2022-3-3 12:45:25

搜索