<?
# http://antwrp.gsfc.nasa.gov/apod/astropix.html

function astropictureoftoday($pic="")
{
    if (empty(
$pic)) $pic "http://antwrp.gsfc.nasa.gov/apod/astropix.html";
        
$fd fopen ($pic"r");

        while (!
feof ($fd)) {
            
$tmp fgets($fd4096);
                if (
eregi("<a href=\"image"$tmp)) {
                        
$astropicture $tmp;
                        break;
                }
        }
        
fclose ($fd);

        
$substr stristr($astropicture,'<img');
        if (
$substr)
                
$astropicture str_replace($substr,'',$astropicture);
        
$astropicture str_replace('">',"",$astropicture);
        
$astropicture str_replace('<a href="','http://antwrp.gsfc.nasa.gov/apod/',$astropicture);
        
$astropicture str_replace('<A href=','http://antwrp.gsfc.nasa.gov/apod/',$astropicture);
        
$astropicture str_replace("\n","",$astropicture);
        
$astropicture str_replace("\r","",$astropicture);
        
$astropicture str_replace('"',"",$astropicture);

        
$substr2 stristr($astropicture,'>');
        if (
$substr2)
                
$astropicture str_replace($substr2,'',$astropicture);

        unset (
$substr);
        unset (
$substr2);

        return 
$astropicture;
}
echo 
"<img src=\"".astropictureoftoday()."\" width=400>";
?>