Jump to content

[SOLVED] Domain from $_SERVER['HTTP_REFERER']


samtay

Recommended Posts

Hey Everyone,

How can I get the domain from $_SERVER['HTTP_REFERER'].

 

For Example:

 

If $_SERVER['HTTP_REFERER'] = http://example.com/somepage/2

then I only want example.com.

 

Also

 

If $_SERVER['HTTP_REFERER'] = http://www.example.com/somepage/2

then I only want example.com, this also apply to other sub domains too.

 

Cheers

Samuel

Link to comment
https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/
Share on other sites

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.