I am using $_SERVER['REQUEST_URI'] ; to get the complete URL address, but in that i want to take only the half, example in $_SERVER['REQUEST_URI'] ; i get http://www.mystore.website.com/index.php?fkdsjklfjdskldfd=id...
but i want to take only till http://www.mystore.website.com, how can i do it?

In PHP is there any function called LastIndex and Substing to use? I am confused. Please help me.


I am doing like this

        $lastIndex = lastIndexOf($myURL,'/');
        $myURL = substr($myURL,0,$lastIndex);
        //echo $myURL;

But nothing is happening. instead of '/' what i can use ... plz help

Hey, sorry for the post. I got it resolved. I was supposed to use $lastIndex = strrpos($myURL, '/', 0); instead of $lastIndex = lastIndexOf($myURL,'/');.

echo $_SERVER["HTTP_HOST"].$_SERVER['php_self']

Member Avatar

Second the parse_url().