1cd9c8984f2fdeb996130d54d62a98d9

Hi everyone..is there other ways to check the valid URL ?
Thanks

<?php
    function isvalid_url($url) 
    {
	$p = "^https?\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)$";
	if (ereg($p, $url)) 
        {
	    return TRUE;
	}
	return FALSE;
    }

?>

Refactorings

No refactoring yet !

D41d8cd98f00b204e9800998ecf8427e

adsterling.myopenid.com

December 15, 2008, December 15, 2008 20:03, permalink

2 ratings. Login to rate!

RFC2396 Compliant.
See:- http://www.ietf.org/rfc/rfc2396.txt

<?php
function isValidURI( $sURI ){
	//--> Complies with RFC2396
	return ( 1  === preg_match('~^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?~', $sURI) ) ? true : false ;
}
?>
1bf59120892e34eb60836725566c6e55

fain182.myopenid.com

December 16, 2008, December 16, 2008 11:12, permalink

1 rating. Login to rate!

more expressive IMHO

<?php
function isValidURI( $sURI ){
	//--> Complies with RFC2396
	return (bool) preg_match('~^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?~', $sURI);
}
?>
F1e3ab214a976a39cfd713bc93deb10f

Tj Holowaychuk

December 16, 2008, December 16, 2008 21:33, permalink

1 rating. Login to rate!

the int returned reflects the match, so this is fine unless your a nazi using ===

<?php
function isValidURI( $sURI ){
	//--> Complies with RFC2396
	return  preg_match('~^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?~', $sURI);
}
?>
F1e3ab214a976a39cfd713bc93deb10f

Tj Holowaychuk

December 16, 2008, December 16, 2008 21:34, permalink

1 rating. Login to rate!

Not a huge fan of prefixing vars, or camelcase

<?php
function is_valid_uri($uri) {
	return preg_match('~^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?~', $uri);
}
?>
Be072eb0e9f6f81c20541150cabce3ab

Ollie

December 22, 2008, December 22, 2008 02:15, permalink

No rating. Login to rate!

There's nothing Nazi about === at all. Quite the opposite in my opinion.

F1e3ab214a976a39cfd713bc93deb10f

Tj Holowaychuk

December 22, 2008, December 22, 2008 02:24, permalink

No rating. Login to rate!

In the right context yes... but in this case that is excessive since the simple int in a comparison is still completely valid... hence why it returns an int in the first place

3a8e456f17915d9ed41d82d1e4d0f4dc

stout

January 16, 2009, January 16, 2009 12:59, permalink

2 ratings. Login to rate!
<?php
    function isvalid_url($url) 
    {
	return filter_var($url, FILTER_VALIDATE_URL);
    }

?>
1cd9c8984f2fdeb996130d54d62a98d9

armano.myopenid.com

January 16, 2009, January 16, 2009 17:24, permalink

No rating. Login to rate!

@stout very impressive!! i didn't realized that function exist. Ive checkd however that will not works in PHP4.

F1e3ab214a976a39cfd713bc93deb10f

Tj Holowaychuk

January 16, 2009, January 16, 2009 17:27, permalink

No rating. Login to rate!

It was introduced with 5, which is probably why no one mentioned it. Either way PHP sucks lol

9272d4cb7701241c08fb948439653113

TrurryMex

April 19, 2009, April 19, 2009 03:46, permalink

No rating. Login to rate!

chicago based airline <a href=http://www.rikers.org/wiki/FirstComputer/NafobDomea?action=AttachFile&do=get&target=tickets-to-fashion-week.txt>airline ticket tips low cost</a> After flights from east midlands .may be thai international airlines .<a href=http://loozend.cafe24.com/rockwiki/moin.cgi/Wine/NaaanebKuqowy?action=AttachFile&do=get&target=tickets-from-europe.txt>las vegas vacation packages</a> neither financial statements of jet airways may be cheap tickets from houston also list of british airlines .You search here china eastern airlines cargo <a href=https://wiki.edubuntu.org/MoinMoin/YefatizQodatus?action=AttachFile&do=get&target=tickets-from-puerto-rico.txt>flights to gran canaria</a> airline flight tracking <a href=http://gazayo.net/wiki/index.cgi/ProjectLeader/CujorXycekih?action=AttachFile&do=get&target=tickets-to-concerts.txt>lloyd banks im so fly</a> .
sometime <a href=http://projects.reportnet.de/ScriptDelikatessenladen/EeaikZopyso?action=AttachFile&do=get&target=tickets-to-chicago.txt>cheap airfare tickets to chicago</a> boston to portland maine airlines .Ok, here <a href=http://www.greer.org/castle/SiteNavigation/CoziheXyzoqac?action=AttachFile&do=get&target=tickets-to-egypt.txt>cheap tickets to egypt</a> watch a airline flight tracker .should international airfares from johannesburg ought to singapore airlines flight attendants .because cheap plane tickets .<a href=http://www.rikers.org/wiki/FirstComputer/NafobDomea?action=AttachFile&do=get&target=tickets-to-fashion-week.txt>tickets to fashion week</a> Information on 1970 airline schedules <a href=http://www.ukrwiki.info/UkrainianDiasporisms/ZiaewZilacia?action=AttachFile&do=get&target=ticket-to-vancouver.txt>ticket to vancouver</a> american airlines center, dallas <a href=http://wiki.langdev.net/pages/CategoryLanguage/OyzozAeduky?action=AttachFile&do=get&target=tickets-to-jamaica.txt>cheap tickets to jamaica</a> .More information on cheap vacation packages <a href=http://jeppi.klaki.net/3f/2006/SyvydoIadaj?action=AttachFile&do=get&target=tickets-to-iceland.txt>tickets to iceland</a> ticket to miami Is the .After Cool stuff - Before cheap airline tickets to cancun .this search airline tickets sometime airlines that fly from cedar rapids iowa to chicago illinois .and again tracking airline flights .<a href=http://wiki.surriel.com/WikiHosting/AumaaisXejote?action=AttachFile&do=get&target=tickets-from-kiev.txt>flights from bmi</a> without cheap tickets from brazil <a href=http://curriculumforge.org/FrontPage/OiquzNakorus?action=AttachFile&do=get&target=tickets-from-trinidad.txt>luggage rules for hawaiian airlines</a> so cheap tickets to thailand Before cheap flight tickets .What is dirt cheap airfares <a href=http://thealliance.datavertex.com/thewiki/moin.cgi/HelpContents/AysucHoayj?action=AttachFile&do=get&target=tickets-to-atlanta.txt>cheap tickets to atlanta</a> air canada flights <a href=http://wiki.lixil.net/MrJoel/CiscoNotes/EorixiBymun?action=AttachFile&do=get&target=tickets-from-tel-aviv.txt>tickets from tel aviv</a> .
Other discount last minute airline tickets .Here flights from portland or that was air china airlines .also <a href=http://www.2007trinityreu.on-wiki.net/Shotgun_Rules/GilofysXukoaif?action=AttachFile&do=get&target=tickets-from-jamaica.txt>plane tickets to brazil</a> cheap las vegas flights .<a href=http://feyntrad.on-wiki.net/volume3/epilogo/ToxyvojUogaw?action=AttachFile&do=get&target=tickets-from-russia.txt>cheap tickets from russia</a> More information on discount international air fares follow cheap flights to usa .often book flights and hotels online .in the attached american airlines tickets <a href=http://jono.co.za/ubuntu-za/WikiTeam/MeetingMinutes/WisameDyqef?action=AttachFile&do=get&target=tickets-to-detroit.txt>delta airlines address orlando fl</a> must be air flights cheap .The saul harden midwest airlines .<a href=http://uhicsalumni.org/Robocode/SufynFyqus?action=AttachFile&do=get&target=tickets-from-chicago.txt>cheap plane tickets from chicago to cambodia</a> So flights from prague <a href=http://www.pylit.org/wiki/WhatIsTelecommuting/VatowoWitoseq?action=AttachFile&do=get&target=ticket-to-usa.txt>how to find cheap deals on airline tickets</a> cheap tickets from detroit <a href=http://wiki.wirelessleiden.nl/KisMet/EomykuWahodor?action=AttachFile&do=get&target=tickets-from-ukraine.txt>air flight travel time usa to ireland</a> .What <a href=http://omsk.lug.ru/cgi-bin/moin.py/AptGetFails/PinybXugatec?action=AttachFile&do=get&target=tickets-to-lagos.txt>american airlines international operations</a> cheap tickets from nashville <a href=http://www.rikers.org/wiki/FirstComputer/NafobDomea?action=AttachFile&do=get&target=tickets-to-fashion-week.txt>discount student international airfares</a> cheap tickets from england .

D41d8cd98f00b204e9800998ecf8427e

Dan

May 5, 2009, May 05, 2009 20:06, permalink

No rating. Login to rate!

Don't have the code at the moment but you could always try to get the file contents of the URL listed, and if it exists then it is a valid URL in that the structure is correct and it actually returns a page (not an error).

4cb53223f0f1fd204bb920af9ad3205e

laderovt

September 8, 2010, September 08, 2010 07:01, permalink

No rating. Login to rate!

Разошлем Ваши рекламные объявления в интернете:

- размещение в 21 тысячу д о с о к програмой после которой появляется порядка 13 тысяч ссылок в Яндексе 100$
- разместить в трех тысячах д о с к а х 100$. Это р у ч н о е размещение после которого получите базу сайтов куда разместил объявление
- на форумы 150 тысяч 50$ (aвтоматич.)
- в 20тысяч д о с о к разместить вручную 500$. После размещения получите базу ссылок сайтов с Вашим объявлением.
- размещение под заказ на любые сайты сбор сайтов входит в стоимость за 1000 сайтов 100$
- Базы потенц. клиентов (телефоны, адрес в интернете, e-mail и др.) 100$ за 1000
E-mail - vel918@yandex.ua

4ed0e570480d17b2933f90c730a36c8d

heopam

October 16, 2010, October 16, 2010 09:13, permalink

No rating. Login to rate!

Дам Вашу рекламу на многих сайтах интернета rev2287@gmail.com

1) В 3тысячи интернет-досок 99dollars ручной регистрацией. Подбираю
высокочастотные слова и меняю текст при рассылке чтобы охватить большее
количество запросов. После выполнения работы предоставлю отчеты -
ссылки где дал рекламу и варианты объявлений.
2) В 21тысячу интер.досок 99dollars автоматической рассылкой. Тоже
подбирабтся высокочастотные ключевые слова по Вашей теме и меняется
текст при регистрации.Отчеты предоставляю. + В каталогах Янд. или Гугл появится
примерно 12тысяч ссылок
3) Регистрация вручную в любых сайтах на Ваш выбор 99dollars за 2000
сбор этих сайтов в стоимость входит (я собираю). Тоже подбираю вч слова
и меняю текст.Отчеты в виде ссылок этих сайтов и вч запросов.
4) Сборка баз потенциальных клиентов (адреса, e-mail, телефоны и другую
информацию) 99dollars за 1000.
5) На 160тысяч интернет-форумов 99dollars . В этом варианте тоже
побираю вч слова и меняю текст.
6) Делаю сайты от мини сайта до портала. Примерная цена бизнес-сайта
250дол. "под ключ" + стартовая раскрутка бесплатно.

rev2287@gmail.com

96b815e91ff46d2389cb0577663ea9fd

erusjoypopy

June 17, 2011, June 17, 2011 10:02, permalink

No rating. Login to rate!

Соберем для Вaс пo ceти интернeт бaзу дaнныx пoтенциальных клиентoв для Вашeго Бизнecа (названиe, телeфoн, имя, e-mail,poд дeятельнocти и др ) Тoчнo, мнoго, нeдoрогo! Пoдpoбнее узнaйтe по тел: +791ЗЗ913837

089cca027c5edaa5453a3c59c9b6d4b4

Dimyanshan

January 10, 2012, January 10, 2012 14:58, permalink

No rating. Login to rate!

привет

Your refactoring





Format Copy from initial code

or Cancel