Home > Backend Development > PHP Tutorial > Example sharing of php getting bing daily wallpaper_PHP tutorial

Example sharing of php getting bing daily wallpaper_PHP tutorial

WBOY
Release: 2016-07-13 10:36:53
Original
1288 people have browsed it

复制代码 代码如下:

 $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
 if(preg_match("/(.+?)/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');
 }
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/736855.htmlTechArticle复制代码 代码如下: ?php $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0 if(preg_match("/url(.+?)/url/ies",$str,$matches)){ $imgurl='http://cn.bing.com...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template