-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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