• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

CGI/Perl Query

ashben

Moderator
I'm no CGI/Perl programmer but need this small script in a hurry. The script should lookup for a given URL (like : http://www.hdjsh.com/dkjsjk.htm) and return true or false based upon its existence and validity. So, if the URL is found the script should return true else false. I feel its just a matter of a particular network function in Perl but don't know which one. Even a C/C++ or TCL script/component would do. I just need a hint, I'll take care of the rest.

If anyone can submit their tips on the script or refer some online reference for perl functions (primarily network).

((( Thanks )))
 
Use the LWP::Simple modules "head" function to see if a remote file exists.
The example below will set $return to "found" or "not found" depending on the existence of the file.


Code:
use LWP::Simple qw(head);
$return = head($url) ? "found" : "not found";
 
Thanks a lot. Just another thing I missed out earlier .. now how to embedd this Perl code in a PHP script (.php), so that in PHP I can check the value of the $return variable.

I know its tricky, but any help would be great!


[Edited by ashben on 12-15-2000 at 01:24 AM]
 
Back
Top