require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$month = 1;
$day = 2;
$url = "https://api.jisuapi.com/todayhistory/query?appkey=$appkey&month=$month&day=$day";
$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'];
foreach($result as $val)
{
echo $val['year'].'年 '.$val['month'].'月 '.$val['day'].'日 '.$val['title'].' '.$val['content'].'
';
}
#!/usr/bin/python
# encoding:utf-8
import urllib2, json, urllib
data = {}
data["appkey"] = "your_appkey_here"
data["month"] = 1
data["day"] = 2
url_values = urllib.urlencode(data)
url = "https://api + jisuapi + com/todayhistory/query" + "?" + 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"]
for val in result:
print val["year"] + "年 " + val["month"] + "月 " + val["day"] + "日 " + val["title"] + " " + val["content"]
package api.jisuapi.todayhistory;
import api.util.HttpUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class Query {
public static final String APPKEY = "your_appkey_here";// 你的appkey
public static final String URL = "https://api.jisuapi.com/todayhistory/query";
public static final String month = "1";
public static final String day = "2";
public static void Get() {
String result = null;
String url = URL + "?appkey=" + APPKEY + "&month=" + month + "&day=" + day;
try {
result = HttpUtil.sendGet(url, "utf-8");
JSONObject json = JSONObject.fromObject(result);
if (json.getInt("status") != 0) {
System.out.println(json.getString("msg"));
} else {
JSONArray resultarr = json.optJSONArray("result");
for (int i = 0; i < resultarr.size(); i++) {
JSONObject obj = (JSONObject) resultarr.opt(i);
String title = obj.getString("title");
String year = obj.getString("year");
String month = obj.getString("month");
String day = obj.getString("day");
String content = obj.getString("content");
System.out.println(title + " " + year + " " + month + " " + day + " " + content);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}