How do I check for a valid URL 
Author Message
 How do I check for a valid URL

Hello,

I'm making a script where someone has to enter their e-mail address
and their URL. For the e-mail check I'm using Matt Wright's method:


   $email !~

   {&Error;}

I want to use a similar method for checking for a valid URL. All I
could think of is this:

if ($url !~ /^http:\/\/.+\..+/i) {&Error;}

I know there are a lot of you that think that this is useless because
you can NEVER prevent someone of typing a valid URL that's not theirs!
But still want to do it.

My question is, does anyone have a method for checking for a valid
URL? Maybe you're using one in a script or you've seen one in a script
somewhere!

Many Thanks,

Rafely



Thu, 03 May 2001 03:00:00 GMT  
 How do I check for a valid URL

Quote:

>My question is, does anyone have a method for checking for a valid
>URL? Maybe you're using one in a script or you've seen one in a script
>somewhere!

Abigail posted a pretty exaustive regex that deals with validating an
URL.  Check dejanews with with a search string of
"~g comp.lang.perl.misc ~a Abigail ~s Counting URLs".

--



Thu, 03 May 2001 03:00:00 GMT  
 How do I check for a valid URL

Quote:

> >My question is, does anyone have a method for checking for a valid
> >URL? Maybe you're using one in a script or you've seen one in a script
> >somewhere!

> Abigail posted a pretty exaustive regex that deals with validating an
> URL.  Check dejanews with with a search string of
> "~g comp.lang.perl.misc ~a Abigail ~s Counting URLs".

that will just check the form of an address - not that it actually
exists.  this is basically the same problem as email address or
credit card number verification.  it might look valid, but eventually
you have to see what happens when you try to use it.

in this case, just pass the url to LWP and see if you can fetch
it.  there are examples of this sort of thing in the LWP docs.

--

CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>



Thu, 03 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Checking if a url is valid

2. Checking if URL is valid/exist using PERL

3. Best way to determine if URL is valid

4. Testing for valid URL before writing HTML code (cgi)

5. valid URL regexp

6. Check for valid perl regex

7. Check for valid hex value

8. checking if mail address is valid

9. checking for a valid date-time

10. A Script for checking emails valid?

11. Checking for valid Email...

12. check for valid e-mail address

 

 
Powered by phpBB® Forum Software