把下面这段代码保存到记事本,命名为bing_today.php(包括原来的.txt也改了),然后部署到网站上,需要的时候直接调用该php文件即可。
这是做好之后的效果:
https://bing.wnag.com.cn/bing_today.php
<?php
if($_GET[‘idx‘]==null){
$str=file_get_contents(‘http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1‘);
}
$str=file_get_contents(‘http://cn.bing.com/HPImageArchive.aspx?idx=‘.$_GET[‘idx‘].‘&n=1‘);
if(preg_match("/<url>(.+?)<\/url>/ies",$str,$matches)){
$imgurl=‘http://cn.bing.com‘.$matches[1];
}
if($imgurl){
header(‘Content-Type: image/JPEG‘);
@ob_end_clean();
@readfile($imgurl);
@flush(); @ob_flush();
exit();
}else{
exit(‘error‘);
}
?>
另外,推荐几个极好的bing壁纸站和bing壁纸调用接口。
必应壁纸
Bing Pictures Interface | 必应壁纸接口
一张1080p随机高清壁纸壁纸
参考:必应壁纸php获取接口
版权所有:可定博客 © WNAG.COM.CN
本文标题:《必应今日壁纸PHP获取》
本文链接:https://wnag.com.cn/1058.html
特别声明:除特别标注,本站文章均为原创,本站文章原则上禁止转载,如确实要转载,请电联:wangyeuuu@qq.com,尊重他人劳动成果,谢过~
叨叨几句... NOTHING