Re: Re: Php filter validate url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guys, when you reply a mail, You should write your reply on the top of it,
not at the bottom of it.
makes it easier to follow.


On Sun, Jun 26, 2011 at 11:44 PM, Shawn McKenzie <nospam@xxxxxxxxxxxxx>wrote:

> On 06/26/2011 12:31 PM, Adam Tong wrote:
> > Hi,
> >
> > I wanted tu use php filters for validation to avoid regular expresions.
> > Is it possible that FILTER_VALIDATE_URL only checks if the string has
> > http:// and do not check for the format domain.something?
> > ----
> > $url = 'http://wwwtestcom';
> > $url = filter_var($url,FILTER_VALIDATE_URL);
> > echo $url;
> > -----
> >
> > Or I am doing something wrong
> >
> > Thank you
>
> Unless I'm totally misunderstanding what you want (validate that a
> string starts with http://) try:
>
> if(strpos($url, 'http://') === 0) {
>   //starts with http://
> } esle {
>   // does not start with http://
> }
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux