首页  >  文章  >  php教程  >  php获取bing每日图片

php获取bing每日图片

WBOY
WBOY原创
2016-06-06 19:33:031830浏览

简单的做了一个php的 DzzOffice 源码与演示: 演示出处 ?php$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0n=1');if(preg_match("/url(.+?)\/url/ies",$str,$matches)){$imgurl='http://cn.bing.com'.$matches[1];}if($imgurl){heade

简单的做了一个php的
DzzOffice

源码与演示: 演示出处

<?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');
	}
?>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn