Getting an image from a website

Every day, NASA’s Astronomy site puts up a new image. What I’m wondering is how could I check to see if there is a new image, and if so display it (download it, or something). I don’t even know if this is possible.

If you can help at all, please let me know.

In what? In VB, you have the Inet control. You download the homepage and find “<IMG SRC=”"" (2 double quotes is a double quote w/o ending the string). Then you take what’s between that and “”"". That is your path. Again using the Inet control, download the image using the path extracted, and save it to a location. Then you can do whatever with it.

Sorry about that, I forgot to mention to display it on another website. Like, would it be possible to do this through PHP, or even ASP? Thanks though very much.

You mean other than having windows run a VBscript? :wink: no idea.

is it just me… or does the pic for 6/5 ( ) look fake?

I would use a cron script that would download the page with wget, delete the html file, then rename the .jpg to the file that you are displaying on your webpage.

Heh. Yea, I kinda thought the same.

A lot of the pictures on there are sweet none-the-less, even if they are fake, though.

Joe: Thanks, I’ll try that and see what happens.

really? how so?

I think they were watching that stupid FOX special about how the Apollo landings were fake. Please see here if you were convinced by that propaganda:

I heard about that. My question to the conspirisy theorists: Where’d the cash go?

I currently have my home computer set up to download the Astronomy Picture of the Day every day, resize it, and put it in my background rotation automatically.

To do it, I used a combination of DailyStrips and ImageMagick.

Full instructions are on my web site at

If you just want to display it on another web site, DailyStrips is a Perl script, and you could set it up to run as a chron job (and write a little script to rename each day’s file to a constant name or modify the Perl to always output the same name), or you could modify it so that it displayed the fetched image as an output when called by a browser.

not that i dont believe that nasa landed on the moon, but its the government. where do you think our money goes :wink:
and if you got a wad of cash and was told you can either use it all up, or you can use half of it to let everyone believe you used it all up, and you keep the rest,which would you do? :smiley:

Where did the rocket go?

–Also…elvis is surely still alive!

The .NET Framework includes a class named WebRequest that will do what you’re asking. You give it a URL and it returns the results as a stream. Then you just read the stream and write it to disk. Check MSDN, there is probably some sample code available.

“you don’t think they spend 200 dollars on a hammer, 500 bucks on a toliot seat do you?”

In PHP, you can also use socket connections (similar to the Inet control in VB). Your hosting service has to allow it though :slight_smile: By the way, fopen will open remote files too.

Thank you :slight_smile:

I’ve checked that out, and as soon as finals are over with, I will try that and see what happens.

Greg: I started thinking about that, but the problem is that NASA creates a new directory (as far as I know) each day for the pictures.

At least a different file for each picture. You pretty much have to extract the URL from the page.