您的位置
主页 > 网站技术 > 语言编程 > » 正文

php获取bing每日壁纸示例分享

来源: 站长圈 点击:

点评:本文主要介绍了使用php获取bing每日壁纸的示例,需要的朋友可以参考下,希望对大家有所帮助!

复制代码 代码如下:

<?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');

 }

?>




首页  - 关于站长圈  - 广告服务  - 联系我们  - 关于站长圈  - 网站地图  - 版权声明