Have a look at this:
function ValidateUrl($url) {
// Check the syntax
if
(!preg_match("!((https?|ftp)://)(www\.)?([a-zA-Z0-9/\-]*)+\.([a-zA-Z0-9/\-]*
)+([a-zA-Z0-9/\-\.]*)?!", $url)) {
return false;
}
// If it's correct, then try and open it
if (!@fopen($url, "r")) {
return false;
}
what are you trying to do?
Jim Lucas
www.bend.com
- Original Message -
From: "John Fishworld" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 23, 2002 4:33 PM
Subject: [PHP] Still REG EX
> I'm still playing about trying to validate an url
> www(dot)something(dot)some
On Sun, 24 Mar 2002, John Fishworld wrote:
>> On Sun, 24 Mar 2002, John Fishworld wrote:
>>> I'm still playing about trying to validate an url
>>> www(dot)something(dot)something !
>>>
>>> I thought this would work but know
>>>
>>> if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str))
>>
>>
Okay good point but still why doesn't it work ?
thanks
john
> On Sun, 24 Mar 2002, John Fishworld wrote:
> > I'm still playing about trying to validate an url
> > www(dot)something(dot)something !
> >
> > I thought this would work but know
> >
> > if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,
On Sun, 24 Mar 2002, John Fishworld wrote:
> I'm still playing about trying to validate an url
> www(dot)something(dot)something !
>
> I thought this would work but know
>
> if (ereg("^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$", $str))
First of all, web server hostnames don't need to start with
5 matches
Mail list logo