This depends on what language you're trying to code it in? In Perl you can use LWP::Simple and use the head() function, in PHP i think you'll have to use fopen and sockets as i'm not aware of a function that gives you these details.