必应壁纸php获取接口

时间:2015-01-11 17:43:00   收藏:0   阅读:1229

<?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‘);
}
?>

原文:http://www.cnblogs.com/u0mo5/p/4216662.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!