-
二维码生成识别
[Java]- https://www.6api.net/api/qrcode/
- 阅读数:78363 上传时间:2020-11-21
- 示例代码
本代码示例是基于Java的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/qrcode/ 申请API服务
以下是完整代码示例:
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/qrcode/qrcode";
//请求方法设置
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("text", "参数1");
params.put("bgcolor", "#FFFFFF");
params.put("fgcolor", "#000000");
params.put("level", "L");
params.put("width", "300");
params.put("margin", "参数6");
params.put("logo", "参数7");
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"