Forum Moderators: coopster

Message Too Old, No Replies

ignore the error if there is true return?

         

tgkprog

2:41 am on Mar 17, 2008 (gmt 0)

10+ Year Member




System: The following 3 messages were cut out of thread at: http://www.webmasterworld.com/forum88/334.htm [webmasterworld.com] by encyclo - 6:23 am on Mar. 17, 2008 (utc -4)


hello is anyone still maintaing these? I needed a is_url. tried to use this but it returns error with everything that i pass it. though in some it returns true - so are we meant to ignore the error if there is true return?

Edit
ok i figured it out. read the description, it returns all the missing components we need to & them

here is my usage now


//copied the fn as on page 1 and replaced the broken pipe with a full pipe the exclamation point replace not relevant here
$ll ="\n<br>\n";

$rel = "../java/q1.html";

function chkUrl($rel, $comps, &$error, &$cleaned) {
global $u1, $ll;
$error = 0;
//$comps = SCHEME + AUTHORITY+ PATH + QUERY + FRAGMENT ;
$cleaned = array();

echo "{$ll}is url [{$rel}] :" ;

//echo "{$ll}err " . $error . "{$ll} Cleaned:{$ll}";

if(! $u1->isUrl($rel, $comps, $error, $cleaned)){
}else{
echo " Ok ";
}

if(($error & SCHEME) == SCHEME && ($comps & SCHEME) == SCHEME)echo " err SCHEME$ll ";
if(($error & AUTHORITY) == AUTHORITY && ($comps & AUTHORITY) == AUTHORITY)echo " err AUTHORITY$ll ";
if(($error & PATH) == PATH && ($comps & PATH) == PATH)echo " err PATH$ll ";

if(($error & QUERY) == QUERY && ($comps & QUERY) == QUERY)echo " err QUERY$ll ";
if(($error & FRAGMENT) == FRAGMENT && ($comps & FRAGMENT) == FRAGMENT)echo " err FRAGMENT$ll ";
if(($error & AUTHORITY_WF) == AUTHORITY_WF && ($comps & AUTHORITY_WF) == AUTHORITY_WF)echo " err AUTHORITY_WF$ll ";

print_r($cleaned);
echo "{$ll}---{$ll} " ;
}

$comps = SCHEME + AUTHORITY+ PATH ;

chkUrl($rel, $comps, $error, $cleaned) ;

chkUrl($u1->url, $comps, $error, $cleaned) ;
$rel = "www.a.dgf/java/q1.html";
chkUrl($rel, $comps, $error, $cleaned) ;

$rel = "http://www.a.dgf/java/q1.html?s=2#s";
chkUrl($rel, $comps, $error, $cleaned) ;

[edited by: tgkprog at 2:57 am (utc) on Mar. 17, 2008]

tgkprog

2:46 am on Mar 17, 2008 (gmt 0)

10+ Year Member



also where can i find the urlencode_querystring defination?

phranque

7:29 am on Mar 17, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], tgkprog!

php.net is a good source of php documentation:
[php.net...]

you should also check out the Charter [webmasterworld.com] and Library [webmasterworld.com] links for the PHP forum...