Skip to content

Instantly share code, notes, and snippets.

@zipus
Forked from gialloporpora/apod.php
Created June 18, 2012 14:07
Show Gist options
  • Save zipus/2948546 to your computer and use it in GitHub Desktop.
Save zipus/2948546 to your computer and use it in GitHub Desktop.
With this code (PHP) you can create an URL that automatically redirect to the APOD (Astronomy Image Of the Day)
/*
With the following code you can create a static url that automatically redirect to the apod (Astronomy Image of the day
* You can use it like wallpaper in your Firefox's about:home page. Look at next file
Download Simple HTML parser from here:
http://simplehtmldom.sourceforge.net/
*/
<?php
$firefoxgalaxy="/image/0502/v838monOct2004_hst_f.jpg";
include('simple_html_dom.php');
$url="http://apod.nasa.gov";
$html=file_get_html($url);
echo $html;
/* $img = $html->find('img', 0)->parent->href; */
if ($img=='') $img=$firefoxgalaxy;
$img="http://apod.nasa.gov/apod/".$img;
header("location: ".$img);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment