techcone Posted February 2, 2009 Share Posted February 2, 2009 Hello , Straight to the point : Input : http://www.forums1.com/index.php http://www.msn.com/forums/index.php http://www.google.com/ssasd/werwe/abc.php Output: http://www.forums1.com/ http://www.msn.com/forums/ http://www.google.com/ssasd/werwe/ Please can anybody provide me some help Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/ Share on other sites More sharing options...
premiso Posted February 2, 2009 Share Posted February 2, 2009 parse_url would help ya. If you would explain exactly what you are trying to do, that might get you a better answer. Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752550 Share on other sites More sharing options...
techcone Posted February 2, 2009 Author Share Posted February 2, 2009 parse_url would help ya. If you would explain exactly what you are trying to do, that might get you a better answer. Actually I provided urls given above in input. I want output as given respectively. I think you got it. Or should I reexplain. Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752551 Share on other sites More sharing options...
RichardRotterdam Posted February 2, 2009 Share Posted February 2, 2009 It is vague what you want. Is it that you want the path of the requested file without the filename? ??? Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752552 Share on other sites More sharing options...
techcone Posted February 2, 2009 Author Share Posted February 2, 2009 It is vague what you want. Is it that you want the path of the requested file without the filename? ??? Exactly Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752555 Share on other sites More sharing options...
premiso Posted February 2, 2009 Share Posted February 2, 2009 Either explode it at / or use parse_url to rebuild it. <?php $url = "http://www.forums1.com/index.php"; $url = parse_url($url); $url = $url['scheme'] . "://" . $url['host'] . "/"; ?> Should work. Quote Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752564 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.