Skip to content

Instantly share code, notes, and snippets.

@itsbalamurali
Last active December 28, 2015 09:29
Show Gist options
  • Save itsbalamurali/7479864 to your computer and use it in GitHub Desktop.
Save itsbalamurali/7479864 to your computer and use it in GitHub Desktop.
Bing Images puller in action http://bingy.herokuapp.com/
<?php
//Bing Images puller in action http://bingy.herokuapp.com/
//this snippet will get the bing.com's current image
$bingimgxml = file_get_contents('http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US');
$bg_img = new SimpleXMLElement($bingimgxml);
$image = $bg_img->image->url;
$img_url ="http://www.bing.com$image";
header('Content-Type: image/jpeg');
readfile($img_url);
//echo $img_url;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment