<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$keyword = '白菜';//utf8
$pagesize = 1;
$pagenum = 1;
$url = "https://api.jisuapi.com/rkl/search?appkey=$appkey&keyword=$keyword&pagesize=$pagesize&pagenum=$pagenum";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['total'].' '.$result['pagesize'].' '.$result['pagenum'].'
';
foreach($result['list'] as $val)
{
echo $val['title'].' '.$val['content'].'
';
}
#!/usr/bin/python
# encoding:utf-8
import urllib2, json, urllib
# 1、绕口令查询
data = {}
data["appkey"] = "your_appkey_here"
data["keyword"] = "白菜"
data["pagesize"] = 1
data["pagenum"] = 1
url_values = urllib.urlencode(data)
url = "https://api.jisuapi.com/rkl/search" + "?" + url_values
request = urllib2.Request(url)
result = urllib2.urlopen(request)
jsonarr = json.loads(result.read())
if jsonarr["status"] != u"0":
print jsonarr["msg"]
exit()
result = jsonarr["result"]
print result["total"],result["pagesize"],result["pagenum"]
for val in result["list"] :
print val["content"],val["title"]
package api.jisuapi.rkl;
import java.net.URLEncoder;
import api.util.HttpUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class Search {
public static final String APPKEY = "your_appkey_here";// 你的appkey
public static final String URL = "https://api.jisuapi.com/rkl/search";
public static final int pagenum = 1;
public static final int pagesize = 1;
public static final String keyword = "白菜";// utf-8
public static void Get() throws Exception {
String result = null;
String url = URL + "?appkey=" + APPKEY + "&keyword=" + URLEncoder.encode(keyword, "utf-8") + "&pagenum="
+ pagenum + "&pagesize=" + pagesize;
try {
result = HttpUtil.sendGet(url, "utf-8");
JSONObject json = JSONObject.fromObject(result);
if (json.getInt("status") != 0) {
System.out.println(json.getString("msg"));
} else {
JSONObject resultarr = json.optJSONObject("result");
String total = resultarr.getString("total");
String pagenum = resultarr.getString("pagenum");
String pagesize = resultarr.getString("pagesize");
System.out.println(total + " " + pagenum + " " + pagesize);
if (resultarr.opt("list") != null) {
JSONArray list = resultarr.optJSONArray("list");
for (int i = 0; i < list.size(); i++) {
JSONObject obj = (JSONObject) list.opt(i);
String content = obj.getString("content");
String title = obj.getString("title");
System.out.println(title + " " + content);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}