1

//新闻60秒早报
function newzaobao(){//60s
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://v2.alapi.cn/api/zaobao",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "token=IAMML4wWVCDJoaYntoken&format=json",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
$a=json_decode($response,true);
$code=$a['code'];
curl_close($curl);
if(is_home()){
    echo "<posts class='posts-item list ajax-item flex' style='padding: 0;margin: 0;box-shadow: none;border-radius: unset;'><div class='post-graphic'><div class='item-thumbnail'><a href='/sixs' title='新闻早早报' rel='noopener noreferrer'>";
    if($code!='200'){
        echo "<img width='100%' height='100%' class=' lazyloaded' src='https://xyblog-1259307513.cos.ap-guangzhou.myqcloud.com/wp-content/uploads/2021/10/e7fb6b704e35.png' data-src='https://xyblog-1259307513.cos.ap-guangzhou.myqcloud.com/wp-content/uploads/2021/10/e7fb6b704e35.png' alt='新闻早早报'>";
    }else{
        echo "<img width='100%' height='100%' class=' lazyloaded' src='" . $a['data']['head_image'] . "' data-src='" . $a['data']['head_image'] . "' alt='新闻早早报'>";
    }
    echo "</a><badge class='img-badge left jb-red' style='background-image: -webkit-linear-gradient(0deg,#3a8ee6 0%,#93c8ff 100%);'>日报</badge></div></div><div class='item-body flex xx flex1 jsb'><h2 class='item-heading'>";
    echo "<a href='/sixs' class='title' title='新闻早早报' rel='noopener noreferrer'>";
    echo "<span class='badge' style='display: inline-block; background-image: -webkit-linear-gradient(0deg,#a9ff00 0%,#007b14 100%);margin-top: -3px;'>日更</span>  新闻早早报</a></h2>";
    if($code!='200'){
        echo "【微语】<a class='abstract weiyu' style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' href='/sixs' title='新闻摘要' rel='noopener noreferrer'></a>";
    }else{
        echo "<a class='abstract' style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' href='/sixs' title='新闻摘要' rel='noopener noreferrer'>" . $a['data']['weiyu'] . "</a>";
    }
    echo "<div class='item-tags scroll-x no-scrollbar mb6'><a class='but c-blue' title='查看更多分类文章' href='https://21lhz.cn/skill/network'><i class='fa fa-folder-open-o' aria-hidden='true'></i>网络资讯</a><a href='https://21lhz.cn/sixs' title='查看此标签更多文章' class='but'># 每日60秒早报</a></div><div class='meta'><ul class='items'><li style='display: inline-block;'><a class='avatar-mini' title='XyPro' href='https://21lhz.cn/archives/author/1?customize_changeset_uuid=c8fb31e5-ccba-48e6-bcb0-b31a132165ab&customize_autosaved=on&customize_messenger_channel=preview-29'><img alt='XyPro的头像-夕阳博客' src='//21lhz.cn/wp-content/uploads/2021/08/home-150x150.jpg' data-src='//21lhz.cn/wp-content/uploads/2021/08/home-150x150.jpg' class='avatar avatar- ls-is-cached lazyloaded'><span class='hide-sm ml3'>XyPro</span></a></li><li class='icon-circle' style='display: inline-block;margin: 0 -6px;'></li><li style='display: inline-block;'>" . date('d', time()) . "日</li><li style='display: inline-block;float: right;'><span class='link'><svg class='icon' aria-hidden='true'><use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#icon-zixun'></use></svg> 新闻</span></li></ul></div></div>"; 
}else{
if($code!='200'){
echo'<script>var str="https://api.03c3.cn/zb/api.php";$.getJSON(str, function(json){var imgid = json.imageUrl;document.getElementById("suolue").src=imgid;});</script><div style="text-align: center;"><img id="suolue" style="width:100%;"></div>';
}else{
echo "<img width='100%' height='100%' class=' lazyloaded' src='" . $a['data']['head_image'] . "' data-src='" . $a['data']['head_image'] . "' alt='新闻早早报'>";
echo "<div style='text-align:center;margin: 20px 0 10px;'><span style='font-size:38px;'>每日新闻</span></div>";
echo "<div style='text-align:center;'><span style='font-size:20px;'>更新时间:".date('Y-m-d', time())."</span></div><br>";
echo "<div><div><h3></h3><span> " . $a['data']['news'][0] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][1] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][2] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][3] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][4] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][5] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][6] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][7] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][8] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][9] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][10] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][11] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][12] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][13] . "</span></div>";
echo "<div><h3></h3><span> " . $a['data']['news'][14] . "</span></div></div>";
echo "<br><div><span style='font-size:16px;margin-left:0;'>" . $a['data']['weiyu'] . "</span></div>";
echo "<div style='text-align:right;margin-top: 20px;'><span style='font-size:20px;'>--- 来自ALAPI</span></div>";
}}};
<?php newzaobao()?>
© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片