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. 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. 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. 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? ??? 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 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. Link to comment https://forums.phpfreaks.com/topic/143463-a-simple-url-problem/#findComment-752564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.