You are here: Re: a (posibly) simple questions... « All PHP « IT news, forums, messages
Re: a (posibly) simple questions...

Posted by Janwillem Borleffs on 10/13/78 11:29

Domestos wrote:
> Hi can you please help me with the code for the following...
>
> I need to pattern match a valid Hyper-Link string from a user input...
>
> i.e.
>
> http://www.domain.com
>
> or
>
> www.domain.com
>
> etc...
>

Sure you could use a regular expression, but perhaps it's more convenient to
try to fetch the content instead:

$url = strpos($url, 'http://') === 0 ? $url : "http://$url";
if (@file_get_contents($url)) {
// URL is valid
}


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация