Jump to content

Get part of a domain


jarvis

Recommended Posts

Hi,

I've the following URL

http://www.domain.com/category/projects/airports

 

How can I get projects from the URL?

 

I had something like:

$ref = $_SERVER["REQUEST_URI"];
$array = explode("/", $ref, 2);
echo $array[2];

Sadly it didn't work  :(

 

Anyone able to point me in the right direction?

 

TIA

Link to comment
https://forums.phpfreaks.com/topic/241348-get-part-of-a-domain/
Share on other sites

Thanks Pikachu2000  but I don't know how else to explain it.

 

I have this domain:

http://www.domain.com/category/projects/airports

 

I need to get the projects part of the domain from it. As this may change to something else, like:

http://www.domain.com/category/location/usa

 

So I can then use the code to get locations. Depending on whether it's location or projects, depends on what I then show on screen.

 

Does that help?

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.