php获取bing背景

代码:

 <?php 
$contents = file_get_contents("http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1"); 
$from='<url>';
$end="</url>";
$q=cut($contents, $from, $end);
echo 'http://cn.bing.com'.$q;
function cut($file,$from,$end){ 
$message=explode($from,$file); 
$message=explode($end,$message[1]); 
return $message[0]; 
} 
?>

发表评论