Script to check if image file is available
Page 1 of 1
Horrordee
Soderator



Posts: 8849
Location: England
PostPosted: Mon, 22nd Aug 2011 13:15    Post subject: Script to check if image file is available
Hey,

I have a request from someone I work with and I don't know how to approach it (my programming skills are minimal).

Basically, we have this website which hosts a number of different image files. At different times of the day, this website goes offline.

We want a script that will check for www.site.com/image.gif every 5 seconds and record the outcome. It could just record the outcome when available, but it'd need to be time stamped.

Any ideas?

HD


Space for rent. Contact me for rates!
Back to top
Werelds
Special Little Man



Posts: 15098
Location: 0100111001001100
PostPosted: Mon, 22nd Aug 2011 13:21    Post subject:
Script as in..Bash? PHP? Ruby? Perl? Python? Razz

It's as simple as doing an HTTP request to the URL and checking the HTTP response code. If it's a 4xx or 5xx status code it's not available (1xx should not occur). Hell, you could even do a cronjob using wget or something like that.
Back to top
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Mon, 22nd Aug 2011 14:01    Post subject:
What werelds said. Tell us the system and if you can run a cronjob and I'm sure he could come up with something Cool Face


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group