DHL快递有没有提供运费查询APi 找了N久,都看不到,官网也没有,就找了个跟踪快递的,但是现在需要的是运费查询的~那么大公司不应该没有提供这个接口吧,一定是我查询方式不对。各位有没有做外贸网站的,遇到类似的需求呢,感激不尽 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class Express{ /* * 网页内容获取方法 */ private function getcontent($url) { if (function_exists("file_get_contents")) { $file_contents = file_get_contents($url); } else { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); } return $file_contents; } /* * 获取对应名称和对应传值的方法 */ private function expressname($order) { $name = json_decode($this->getcontent("http://www.kuaidi100.com/autonumber/auto?num={$order}"), true); $result = $name[0]['comCode']; if (empty($result)) { return false; } else { return $result; } } /* * 返回$data array 快递数组查询失败返回false * @param $order 快递的单号 * $data['ischeck'] ==1 已经签收 * $data['data'] 快递实时查询的状态 array */ public function getorder($order) { $keywords = $this->expressname($order); if (!$keywords) { return false; } else { $result = $this->getcontent("http://www.kuaidi100.com/query?type={$keywords}&postid={$order}"); $data = json_decode($result, true); return $data; } }} 看看我用的adodb连接数据库添加数据怎么都提示错误呢? html改PHP(急。求PHP高手) 学习PHP,需要多多实践 那位大哥有wordpress的使用指南之类的东西? php如何抓取网页中的数据? 老板要求做一个电子商务类网站,哪里有模板下啊? 请问用imagick如何把图片的四个角切成圆边 如何在模版里,写查找语句,谢谢。很急。在线等, 推荐一个超强的PHP表达式求值的类 smarty的循环问题 phpqrcode 生成的二维码图片能居中吗? 微信第三方一键授权登陆获取的openid与公众号通过回调获取的openid一致么?
{
/*
* 网页内容获取方法
*/
private function getcontent($url)
{
if (function_exists("file_get_contents")) {
$file_contents = file_get_contents($url);
} else {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
}
return $file_contents;
} /*
* 获取对应名称和对应传值的方法
*/
private function expressname($order)
{
$name = json_decode($this->getcontent("http://www.kuaidi100.com/autonumber/auto?num={$order}"), true);
$result = $name[0]['comCode'];
if (empty($result)) {
return false;
} else {
return $result;
}
} /*
* 返回$data array 快递数组查询失败返回false
* @param $order 快递的单号
* $data['ischeck'] ==1 已经签收
* $data['data'] 快递实时查询的状态 array
*/
public function getorder($order)
{
$keywords = $this->expressname($order);
if (!$keywords) {
return false;
} else {
$result = $this->getcontent("http://www.kuaidi100.com/query?type={$keywords}&postid={$order}");
$data = json_decode($result, true);
return $data;
}
}
}