获取必应每日背景图片 ,是一个PHP模板,代码如下:
<html>
<?php
/*
Template Name:bing
*/
?>
<title>必应每日图片</title>
<body>
<p>必应每日图片</p>
<?php
$str=file_get_contents(‘http://cn.bing.com/HPImageArchive.aspx?idx=0&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’);
}
?>
</body>
</html>
看看您的博客!