教程
- 前往ALAPI注册一个账号并登录
-
在个人管理-个人中心页面复制你的Token,然后替换下方代码的“你的Token”

- 修改好后复制,新建博客文章,粘贴到正文部分,这样60s早报的主体部分就配置好了
选增部分,设置文章头图(自定义缩略图)
- 复制下方代码,将代码中“你的Token”字样替换,在网站根目录创建文件命名好,将代码粘贴保存文件
<?php
function curl(url,post = 0, referer = 0,cookie = 0, header = 0,ua = 0, nobaody = 0) {ch = curl_init();
curl_setopt(ch, CURLOPT_URL,url);
curl_setopt(ch, CURLOPT_SSL_VERIFYPEER, false);httpheader[] = "Accept:application/json";
httpheader[] = "Accept-Encoding:gzip,deflate,sdch";httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
httpheader[] = "Connection:close";
curl_setopt(ch, CURLOPT_HTTPHEADER, httpheader);
if (post) {
curl_setopt(ch, CURLOPT_POST, 1);
curl_setopt(ch, CURLOPT_POSTFIELDS, post);
}
if (header) {
curl_setopt(ch, CURLOPT_HEADER, true);
}
if (cookie) {
curl_setopt(ch, CURLOPT_COOKIE,cookie);
}
if (referer) {
if (referer == 1) {
curl_setopt(ch, CURLOPT_REFERER, 1);
} else {
curl_setopt(ch, CURLOPT_REFERER, referer);
}
}
if (ua) {
curl_setopt(ch, CURLOPT_USERAGENT,ua);
} else {
curl_setopt(ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0");
}
if (nobaody) {
curl_setopt(ch, CURLOPT_NOBODY, 1);
}
curl_setopt(ch, CURLOPT_ENCODING, "gzip");
curl_setopt(ch, CURLOPT_RETURNTRANSFER, 1);ret = curl_exec(ch);
curl_close(ch);
return ret;
}a=curl('https://v2.alapi.cn/api/zaobao?token=你的Token');
b=json_decode(a,true);
c=b['data']['head_image'];
img=b['data']['image'];
if(_GET['s']=='image'){
die(header('location:'.img));
}else{
die(header('location:'.$c));
}
?>
- 效果如下
Comments | NOTHING