[PHP] Checking a URL string.

2003-12-12 Thread Philip J. Newman
I would like to check if i have a correct url enterend ?php eregi(^http://[([0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$, $websiteUrl); ? --- Philip J. Newman Master Developer PhilipNZ.com [NZ] Ltd. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] Checking for a string.

2002-10-29 Thread ed
I'm currently writting a redirect script for my site which will transfer someone to either a external link or a directory on my server. In order to do this I need to use a directive that either contains the directory path or a URL. How do I check the contents of a string to see if it contains

Re: [PHP] Checking for a string.

2002-10-29 Thread John Nichel
preg_match() [EMAIL PROTECTED] wrote: I'm currently writting a redirect script for my site which will transfer someone to either a external link or a directory on my server. In order to do this I need to use a directive that either contains the directory path or a URL. How do I check the

Re: [PHP] Checking for a string.

2002-10-29 Thread ed
Seems to work but I'm getting a Warning Message: Delimiter must not be alphanumeric or backslash Here's the code: $path = http://somehost.somedomain.com;; preg_match (http, $path, $matches); if ($matches[0] = http) { $action = this action; } else { $action = that action; }

Re: [PHP] Checking for a string.

2002-10-29 Thread John Nichel
http://www.php.net/manual/en/function.preg-match.php Wrong syntax, and more code than needed. Your code would always resolve true (if ($matches[0] = http)). Doing that sets the value of $matches[0] to http. Equality is ==. RTFM. If all you want to know is if the URL contains a http,

Re: [PHP] Checking for a string.

2002-10-29 Thread ed
Thanks, figured that out shortly after I posted. Ed On Tue, 29 Oct 2002, John Nichel wrote: http://www.php.net/manual/en/function.preg-match.php Wrong syntax, and more code than needed. Your code would always resolve true (if ($matches[0] = http)). Doing that sets the value of