CURL
curl -i -k --get --include 'http://yinsihao.123yiche.com/module/yinsihao/apiaccount.php?job=getminutes' -H 'Authorization:你自己的AppSECRET'
PHP
$host="http://yinsihao.123yiche.com";
$path="/module/yinsihao/apiaccount.php";
$method="GET";
$appsecret="你自己的AppSecret";
$headers=array();
array_push($headers,"Authorization:".$appsecret);
$querys="job=getminutes";
$bodys="";
$url=$host.$path."?".$querys;
$curl=curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST,$method);
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
curl_setopt($curl, CURLOPT_FAILONERROR,false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_HEADER,true);
if(1==strpos("$".$host,"https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,false);
}
var_dump(curl_exec($curl));JAVA
public static void main(String[] args) {
String host = "http://yinsihao.123yiche.com";
String path = "/module/yinsihao/apiaccount.php";
String method = "GET";
String appsecret = "你自己的AppSecret";
Map<String,String>headers = new HashMap<String,String>();
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization",appsecret);
Map<String,String>querys = new HashMap<String,String>();
querys.put("job", "getminutes");
try {
/**
* 重要提示如下:
* HttpUtils请从
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
* 下载
*
* 相应的依赖请参照
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
*/
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
System.out.println(response.toString());
//获取response的body
//System.out.println(EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
}
}Python
import urllib, urllib2, sys
import ssl
host = 'http://yinsihao.123yiche.com'
path = '/module/yinsihao/apiaccount.php'
method = 'GET'
appsecret = "你自己的AppSecret";
querys = 'job=getminutes'
bodys = {}
url = host + path + '?' + querys
request = urllib2.Request(url)
request.add_header('Authorization', 'APPCODE ' + appcode)
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
print(content)失败响应
{
"code": 400, //指返回结果码,并非http状态码
"msg": "域名校验失败",
}成功响应
{
"code": 200,
"msg": "ok",
"data": {
"domain": "daili.123yiche.com",
"haomachi": "1",
"yz": "1",
"startime": "1602805033",
"endtime": "1760571433",
"threshold": "100",
"remaining_minutes": "5705",//账户剩余时长
"total_minutes": "10000",//有效充值包时长
}
}

