require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/creditblacklist";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"realname" => "参数1",
"idcard" => "参数2"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/creditblacklist";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("realname", "参数1");
params.put("idcard", "参数2");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/creditblacklist"
headers = None
params = {
"appkey" : "yourappsecret",
"realname" : "参数1",
"idcard" : "参数2"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
prin
{
"status": 0,
"msg": "ok",
"result": {
"realname": "何某文",
"idcard": "510224196911117077",
"list": [
{
"age": "47",
"sex": "男",
"idcard": "5102241969****7077",
"filingdate": "2016年06月21日",
"caseno": "(2016)渝0105执2783号",
"baseonno": "(2016)渝0105民初7339号",
"baseonorg": "重庆市江北区人民法院",
"court": "重庆市江北区人民法院",
"province": "重庆",
"duty": "见判决书",
"performance": "全部未履行",
"description": "其他有履行能力而拒不履行生效法律文书确定义务",
"pubdate": "2016年06月21日"
},
{
"age": "46",
"sex": "男",
"idcard": "5102241969****7077",
"filingdate": "2015年10月27日",
"caseno": "(2015)中区法民执字第03114号",
"baseonno": "(2015)中区法民初字第05305号",
"baseonorg": "重庆市渝中区人民法院",
"court": "重庆市渝中区人民法院",
"province": "重庆",
"duty": "被告何某文在本判决生效之日起十日内偿还原告招商银行股份有限公司信用卡中心截止至2015年3月20日的信用卡欠款本金88142.29元,利息1999.78元,费用12203.19元,并支付从2015年3月21日起至付清之日止,以本金88142.29元为基数,按每日万分之五计收的利息。 ",
"performance": "全部未履行",
"description": "其他有履行能力而拒不履行生效法律文书确定义务",
"pubdate": "2015年11月13日"
}
]
}
}