![]() |
PHP guys please fix this shit for me
PHP Code:
Please fix this so result is only www.wojfun.com (without http://) thanks!!! |
check http://php.net/parse_url
|
$url = "http://www.site.com/blah/etc.com";
// remove the http:// $url = str_replace("http://","",$url); // split at "/" $exp = explode("/",$url); // result is everything before first / $end = $exp[0]; theres shorter ways but to show whats going on |
Edit - Nevermind.
|
or you could just add this to the code you have ( last line )
$trimmed_url = str_replace("http://","",$trimmed_url); |
Quote:
|
if you do it this way then the url can either have http:// or not it wont matter
|
Quote:
|
preg_match('!^https?://([a-zA-Z\-_\.0-9]+)!',addslashes(htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES)), $ref);
$ref[1] result in www.referringsite.com |
Quote:
|
Quote:
|
I like the perl version:
Code:
print "please paypal $100"; |
Quote:
|
Code:
$full_url = "http:///www.wojfun.com/contactus_form.html"; |
Code:
$trimmed_url = preg_replace('/^http:\/\/:/', '', $full_url); |
All times are GMT -7. The time now is 06:17 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123