search
HomeBackend DevelopmentPHP TutorialVarious express inquiries--Api interface_php digest


Authorization successful my key

If you reprint, please indicate the source http://blog.csdn.net/qxs965266509, please pay attention!

Aicha Express API instruction document API address:

Previously: http://api.ickd.cn/?com=[]&nu=[]&id=[]&type=[]&encode=[]&ord=[]&lang=[]

Currently: http://api.ickd.cn/?id=[]&secret=[]&com=[]&nu=[]&type=[]&encode=[]&ord=[]&lang=[]

Parameter description

Field Is it necessary Note that com must have a courier company code (English). The supported courier companies are listed below. nu must have a courier order number, and the length must be greater than 5 digits id
secret must
ID that must be authorized
Authorize KEY, to apply please click Express Query API application method type optional return result type, the values ​​are html | json (default) | text | xmlencode optional gbk (default) | utf8ord optional asc (default) | desc, return results Sorting lang is optionalenReturn English results, currently only supports some express delivery (EMS, SF Express, DHL)Note:When using PHP’s json_decode function, UTF8 encoding must be used. If json_decode appears Failure, please try using UTF8 encoding. Return format: json | text | html | xml
Encoding: GBK| UTF8
Example: {"status":"3","message":"","errCode":"0","data":[{"time":"2013-02-23 17:10","context" :"The recipient Wang Guang of the Fourth Department Company in Zhongshan District, Dalian City, Liaoning Province has received the receipt"},{"time":"2013-02-24 17:59","context":"The company in Dalian City, Liaoning Province has received the receipt "},{"time":"2013-02-24 18:11","context":"The Fourth Department Company of Zhongshan District, Dalian City, Liaoning Province has received the receipt"},{"time":"2013-02-26 07 ; ":"Customer colleagues send and receive family members and have signed for delivery person Zhang Jinda"}],"html":"","mailNo":"7151900624","expTextName":"YTO Express","expSpellName":"yuantong"," update":"1362656241","cache":"186488","ord":"ASC"}Field description Field type Description statusint query result status, 0|1|2|3|4, 0 means query failed, 1 normal, 2 dispatching, 3 signed for, 4 returned, 5 other problems errCodeint error code, 0 no error, 1 order number not Exists, 2 verification code error, 3 link query server failure, 4 internal program error, 5 program execution error, 6 express delivery number format error, 7 express company error, 10 unknown error messagestring error message dataarray progress htmlstring other HTML, this field is not There must be mailNostring courier number expSpellNamestring courier company English code expTextNamestring courier company Chinese name updateint last update time (unix timestamp) cacheint cache time, the difference between the current time and update, the unit is: seconds ordstring sorting, ASC | DESCphp application Example
<script language="javascript"> <&#63;php$id='xxxxxxxxxxxxxxxxx';
//到<a href="http://www.ickd.cn/api/reg.html">http://www.ickd.cn/api/reg.html</a>申请
$url='http://api.ickd.cn/&#63;com=shentong&nu=588035733628&id='.$id; $data=file_get_contents($url); 
//echo "var data='",$data,"'"; &#63;> $(function(){
 var dataObj=<&#63;=$data&#63;>;
//转换为json对象 var html='<tr>'; html+='<th>物流状态:</th>'; 
html+='<td>'; 
if(dataObj.status>0){ 
html+='<table width="520px" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; border-spacing: 0pt;">'; html+='<tr>'; 
html+='<td width="163" style="background-color:#e6f9fa;border:1px solid #75c2ef;font-size:14px;font-weight:bold;height:20px;text-indent:15px;">'; 
html+='时间'; html+='</td>'; 
html+='<td width="354" style="background-color:#e6f9fa;border:1px solid #75c2ef;font-size:14px;font-weight:bold;height:20px;text-indent:15px;">'; html+='地点和跟踪进度'; html+='</td>'; html+='</tr>'; //输出data的子对象变量 $.each(dataObj.data,function(idx,item){  html+='<tr>'; 
html+='<td width="163" style="border:1px solid #dddddd;font-size: 12px;line-height:22px;padding:3px 5px;">';  html+=item.time;// 每条数据的时间  html+='</td>';  html+='<td width="354" style="border:1px solid #dddddd;font-size: 12px;line-height:22px;padding:3px 5px;">';  html+=item.context;// 每条数据的状态  html+='</td>';  html+='</tr>'; }); html+='</table>'; }else{
//查询不到 
html+='<span style="color:#f00">Sorry! '+dataObj.message+'</span>'; }
 html+='</td></tr>'; $("#shipping_detail").append(html);});</script>

If the server has disabled functions such as file_get_contents and fsockopen, you can use the CURL class. The example is as follows:

<&#63;php $id='xxxxxxxxxxxxx';
//API KEY $com='shunfeng';
//快递公司 $nu='123456';
//快递单号 $type='json';
 $encode='utf8'; 
$gateway=sprintf('http://api.ickd.cn/&#63;id=%s&com=%s&nu=%s&encode=%s&type=%s',$id,$com,$nu,$encode,$type); 
$ch=curl_init($gateway); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); 
curl_setopt($ch,CURLOPT_HEADER,false); $resp=curl_exec($ch); 
$errmsg=curl_error($ch); if($errmsg){ exit($errmsg); } curl_close($ch);
 echo $resp;&#63;>

ASP application example

Response.Charset="gb2312"
Server.ScriptTimeout = 999999999

Dim Retrieval
Dim url,nu,com
com = Request("com")'Company
nu = Request("nu")'Order number

Dim AppKey,SendURL,ResponseTxt
AppKey = "xxxxxxxxxx" 'Please replace XXXXXX with the KEY you applied for at http://www.ickd.cn/reg.html
SendURL="http://api.ickd.cn/?id="&AppKey&"&com="&com&"&nu="&nu&"&type=json&encode=GBK"'If using UTF8, please make sure encode=utf8
'Response.Write SendURL

'Send data
ResponseTxt=fopen(SendURL) '//Function to get source code

'Call the send data component
Function fopen(URL)
Dim objXML
'Set objXML=CreateObject("MSXML2.SERVERXMLHTTP.3.0") 'Call the XMLHTTP component. If the server does not support it, please use one of the following two and try again
Set objXML=Server.CreateObject("Microsoft.XMLHTTP")
'Set objXML=Server.CreateObject("MSXML2.XMLHTTP.4.0")

'objXML.SetTimeouts 5000, 5000, 30000, 10000' The timeout for resolving DNS names, the timeout for establishing a Winsock connection, the timeout for sending data, and the timeout for receiving responses. Unit millisecond
objXML.Open "GET",URL,False 'Get API query data synchronously
objXML.Send() 'Send
If objXML.Readystate4 Then 'The status is not 4, error
Response.Write "{status:0,errCode:100,message:'Error getting data'}"
Exit Function
End If
'Readystate attribute returns the current status of the XML file data. The return values ​​are as follows:
'0-UNINITIALIZED: XML object was generated, but no file was loaded.
'1-LOADING: Loading is in progress, but file parsing has not yet begun.
'2-LOADED: Some files have been loaded and parsed, but the object model has not yet taken effect.
'3-INTERACTIVE: Only valid for loaded partial files, in which case the object model is valid but read-only.
'4-COMPLETED: The file has been completely loaded, indicating that the loading is successful.

fopen=objXML.ResponseBody
fopen=BytesToBstr(objXML.ResponseBody)' returns information and uses function definition encoding. If you need to transcode, please select

Set objXML=Nothing'Close
If Err.number0 Then
Response.Write "{status:0,errCode:100,message:'Error getting data'}"
Err.Clear
End If
End Function

'Page encoding conversion
Function BytesToBstr(body)
Dim objstream
Set objstream = Server.CreateObject("Adodb.Stream") '//Call adodb.stream component
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GBK" 'Convert the original default encoding to GB2312 encoding, otherwise directly using XMLHTTP to call a webpage with Chinese characters will result in garbled codes
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function

'Enter query results
Response.Write ResponseTxt
%>

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
如何快速把你的 Python 代码变为 API如何快速把你的 Python 代码变为 APIApr 14, 2023 pm 06:28 PM

提到API开发,你可能会想到DjangoRESTFramework,Flask,FastAPI,没错,它们完全可以用来编写API,不过,今天分享的这个框架可以让你更快把现有的函数转化为API,它就是Sanic。Sanic简介Sanic[1],是Python3.7+Web服务器和Web框架,旨在提高性能。它允许使用Python3.5中添加的async/await语法,这可以有效避免阻塞从而达到提升响应速度的目的。Sanic致力于提供一种简单且快速,集创建和启动于一体的方法

如何进行XXL-JOB API接口未授权访问RCE漏洞复现如何进行XXL-JOB API接口未授权访问RCE漏洞复现May 12, 2023 am 09:37 AM

XXL-JOB描述XXL-JOB是一个轻量级分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。一、漏洞详情此次漏洞核心问题是GLUE模式。XXL-JOB通过“GLUE模式”支持多语言以及脚本任务,该模式任务特点如下:●多语言支持:支持Java、Shell、Python、NodeJS、PHP、PowerShell……等类型。●WebIDE:任务以源码方式维护在调度中心,支持通过WebIDE在线开发、维护。●动态生效:用户在线通

PHP8.0中的API客户端库:GuzzlePHP8.0中的API客户端库:GuzzleMay 14, 2023 am 08:54 AM

随着网络技术的发展,Web应用程序和API应用程序越来越普遍。为了访问这些应用程序,需要使用API客户端库。在PHP中,Guzzle是一个广受欢迎的API客户端库,它提供了许多功能,使得在PHP中访问Web服务和API变得更加容易。Guzzle库的主要目标是提供一个简单而又强大的HTTP客户端,它可以处理任何形式的HTTP请求和响应,并且支持并发请求处理。在

让机器人学会咖啡拉花,得从流体力学搞起!CMU&amp;MIT推出流体模拟平台让机器人学会咖啡拉花,得从流体力学搞起!CMU&amp;MIT推出流体模拟平台Apr 07, 2023 pm 04:46 PM

机器人也能干咖啡师的活了!比如让它把奶泡和咖啡搅拌均匀,效果是这样的:然后上点难度,做杯拿铁,再用搅拌棒做个图案,也是轻松拿下:这些是在已被ICLR 2023接收为Spotlight的一项研究基础上做到的,他们推出了提出流体操控新基准FluidLab以及多材料可微物理引擎FluidEngine。研究团队成员分别来自CMU、达特茅斯学院、哥伦比亚大学、MIT、MIT-IBM Watson AI Lab、马萨诸塞大学阿默斯特分校。在FluidLab的加持下,未来机器人处理更多复杂场景下的流体工作也都

Vue3 Composition API怎么优雅封装第三方组件Vue3 Composition API怎么优雅封装第三方组件May 11, 2023 pm 07:13 PM

前言对于第三方组件,如何在保持第三方组件原有功能(属性props、事件events、插槽slots、方法methods)的基础上,优雅地进行功能的扩展了?以ElementPlus的el-input为例:很有可能你以前是这样玩的,封装一个MyInput组件,把要使用的属性props、事件events和插槽slots、方法methods根据自己的需要再写一遍://MyInput.vueimport{computed}from&#39;vue&#39;constprops=define

SpringBoot怎么实现api加密SpringBoot怎么实现api加密May 15, 2023 pm 11:10 PM

SpringBoot的API加密对接在项目中,为了保证数据的安全,我们常常会对传递的数据进行加密。常用的加密算法包括对称加密(AES)和非对称加密(RSA),博主选取码云上最简单的API加密项目进行下面的讲解。下面请出我们的最亮的项目rsa-encrypt-body-spring-boot项目介绍该项目使用RSA加密方式对API接口返回的数据加密,让API数据更加安全。别人无法对提供的数据进行破解。SpringBoot接口加密,可以对返回值、参数值通过注解的方式自动加解密。什么是RSA加密首先我

Windows 11 正在获得一项新的 API 支持的功能来解决网络问题Windows 11 正在获得一项新的 API 支持的功能来解决网络问题Apr 20, 2023 pm 02:28 PM

当您的WindowsPC出现网络问题时,问题出在哪里并不总是很明显。很容易想象您的ISP有问题。然而,Windows笔记本电脑上的网络并不总是顺畅的,Windows11中的许多东西可能会突然导致Wi-Fi网络中断。随机消失的Wi-Fi网络是Windows笔记本电脑上报告最多的问题之一。网络问题的原因各不相同,也可能因Microsoft的驱动程序或Windows而发生。Windows是大多数情况下的问题,建议使用内置的网络故障排除程序。在Windows11

设计API接口时,要注意这些地方!设计API接口时,要注意这些地方!Jan 09, 2023 am 11:10 AM

本篇文章给大家带来了关于API的相关知识,其中主要介绍了设计API需要注意哪些地方?怎么设计一个优雅的API接口,感兴趣的朋友,下面一起来看一下吧,希望对大家有帮助。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor