Looktrne Posted June 29, 2008 Share Posted June 29, 2008 ok here is a tough one for me.. I need to strip this string http://www.nosite.net/members/index.php?page=whos_online it needs to become nosite.net I also need to strip it to just: http://www.nosite.net keep in mind that this may or may not contain the www. and it needs to cut the string from the / but leave the first double // along any ideas? Paul Link to comment https://forums.phpfreaks.com/topic/112434-solved-more-fine-tuning-substr-i-will-get-it-sooner-or-later/ Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 There is an inbuilt mechanism to parse URL's in PHP that could do what you need. http://uk3.php.net/function.parse-url Link to comment https://forums.phpfreaks.com/topic/112434-solved-more-fine-tuning-substr-i-will-get-it-sooner-or-later/#findComment-577223 Share on other sites More sharing options...
Looktrne Posted July 4, 2008 Author Share Posted July 4, 2008 this code worked for cleaning a url $code="http://abmatch.com/index.php?page=contact"; $mem = strpos($code, "//"); $code = substr($code, ($mem)+2, strlen($code)); $mem = strpos($code, "/"); $code = substr($code, 0, $mem); thanks Link to comment https://forums.phpfreaks.com/topic/112434-solved-more-fine-tuning-substr-i-will-get-it-sooner-or-later/#findComment-581520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.