The free api interface of jokes includes dynamic images of picture segments
Interface address: http://api.xiaoliaoba.cn/Index/duanzi.html
Supported formats: JSON/xm
Request method: GET/POST
Joke categories: duanzi (jokes), tupian (pictures), gif (dynamic pictures)
Request example: http://api.xiaoliaoba.cn/Index/duanzi.html?count=10&page=1&key=APPKEY
Request parameters:
Name Type Required Description
key string is API KEY
count Int No The number of data obtained on a single page, the default is 10
page Int No Get the data of the specified page, the default is 1
PHP code example: <?php<br />
$curl = curl_init();<br />
curl_setopt_array($curl, array(<br />
CURLOPT_URL => "http://api.xiaoliaoba.cn/Index/duanzi.html?key=APPKEY",<br>
CURLOPT_RETURNTRANSFER => true,<br>
CURLOPT_ENCODING => "",<br>
CURLOPT_MAXREDIRS => 10,<br>
CURLOPT_TIMEOUT => 30,<br>
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,<br>
CURLOPT_CUSTOMREQUEST => "GET",<br>
));<br>
$response = curl_exec($curl);<br>
$err = curl_error($curl);<br>
curl_close($curl);<br>
if ($err) {<br>
echo "cURL Error #:" . $err;<br>
} else {<br>
echo "<pre class="brush:php;toolbar:false">";<br>
var_dump(json_decode($response,true));<br>
}
JSON return example: {<br>
"error_code": 0,<br>
"reason": "Success",<br>
"result": [{<br>
"title": "If descendants are unfilial",<br>
"content": "If my future children are unfilial, then before I die, I will call them to my side and tell them: In fact, I have 5 million. I hid it in..., and then drive west to seek death for those bastards." . ",<br>
"type": "1",<br>
"updatetime": "2016-01-22 09:14"<br>
},<br>
{<br>
"title": "You think everyone is like you",<br>
"content": "Two days ago, I was chatting in a game group and a girl said she was getting married. Her friends gave her all kinds of blessings. Then someone suddenly said that the girl was getting married before she turned 20, and she also said yes. Why are you getting married at such a young age? But someone next to me said, "You think everyone is an old woman with two wheels and you can't get married?" ,<br>
"type": "1",<br>
"updatetime": "2016-01-22 00:09"<br>
}]<br>
}
Please visit http://www.xiaoliaoba.cn/api for details