require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/enterprise/query";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"company" => "参数1",
"creditno" => "参数2",
"regno" => "参数3"
);
$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/enterprise/query";
//请求方法设置
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("company", "参数1");
params.put("creditno", "参数2");
params.put("regno", "参数3");
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/enterprise/query"
headers = None
params = {
"appkey" : "yourappsecret",
"company" : "参数1",
"creditno" : "参数2",
"regno" : "参数3"
}
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 (stat
{
"status": 200,
"msg": "OK",
"result": {
"basic": {
"name": "华为技术有限公司",
"type": "有限责任公司(自然人投资或控股的法人独资)",
"legalperson": "赵明路",
"personid": null,
"regcapital": "3990813.182000万人民币",
"creditno": "914403001922038216",
"regno": "440301103097413",
"orgno": "192203821",
"regdate": "1987-09-15",
"canceldate": null,
"regaddress": "深圳市龙岗区坂田华为总部办公楼",
"startdate": "1987-09-15",
"enddate": "2040-04-09",
"scope": "程控交换机、传输设备、数据通信设备、宽带多媒体设备、电源、无线通信设备、微电子产品、软件、系统集成工程、计算机及配套设备、终端设备及相关通信信息产品、数据中心机房基础设施及配套产品(含供配电、空调制冷设备、智能管理监控等)的开发、生产、销售、技术服务、工程安装、维修、咨询、代理、租赁;信息系统设计、集成、运行维护;集成电路设计、研发;统一通信及协作类产品,服务器及配套软硬件产品,存储设备及相关软件的研发、生产、销售;无线数据产品(不含限制项目)的研发、生产、销售;通信站点机房基础设施及通信配套设备(含通信站点、通信机房、通信电源、机柜、天线、通信线缆、配电、智能管理监控、锂电及储能系统等)的研",
"regorgan": "龙岗局",
"approvaldate": "2018-12-28",
"status": "存续(在营、开业、在册)",
"province": "广东",
"city": "",
"tel": "",
"mobile": null,
"category": "",