How to check a url is valid

How to check a url is valid

am 15.11.2005 00:17:04 von unknown

Post removed (X-No-Archive: yes)

Re: How to check a url is valid

am 15.11.2005 01:11:00 von Bill Karwin

Krustov wrote:
> Any recommended methods I could use to check the url is valid before
> accepting it ? .

One thing you could do is resolve the domain name they type in.
Tools like dig or nslookup can do this.

Here's a PHP package (GPL license) that says it does this, but I haven't
used it:
http://www.hotscripts.com/Detailed/47915.html
No doubt there are other similar PHP functions available out there.

Regards,
Bill K.

Re: How to check a url is valid

am 15.11.2005 01:20:27 von Toby Inkster

Krustov wrote:

> Any recommended methods I could use to check the url is valid before
> accepting it ? .

if ( @open($url, 'r') === FALSE )
echo "URL Fake\n";
else
echo "Go ahead!\n";

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Re: How to check a url is valid

am 15.11.2005 02:08:07 von unknown

Post removed (X-No-Archive: yes)

Re: How to check a url is valid

am 15.11.2005 02:08:07 von unknown

Post removed (X-No-Archive: yes)

Re: How to check a url is valid

am 15.11.2005 02:38:05 von unknown

Post removed (X-No-Archive: yes)

Re: How to check a url is valid

am 15.11.2005 21:20:39 von Toby Inkster

Krustov wrote:

> @open didnt work for me - but fopen appears to work fine .

That's the one. My mistake -- should have tested it really.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Re: How to check a url is valid

am 16.11.2005 03:09:39 von unknown

Post removed (X-No-Archive: yes)

Re: How to check a url is valid

am 16.11.2005 09:36:30 von Toby Inkster

Toby Inkster wrote:

> Krustov wrote:
>
>> @open didnt work for me - but fopen appears to work fine .
>
> That's the one. My mistake -- should have tested it really.

I still advise using the @-sign though:

@fopen()

the @ suppresses PHP's error-printing (assuming you have it switched on at
all), so the visitors won't see any ugly message if things go wrong --
just your own pretty message.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Re: How to check a url is valid

am 16.11.2005 15:05:19 von unknown

Post removed (X-No-Archive: yes)