MikeLamb
Member
Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
|
How do i find out where the script was called from? Ie, the script could be called from http://anything.domain.com/script.php and i need to what the http://anything.domain.com is?
Cheers
|
Laney
Member
Registered: 6th May 03
Location: Leeds
User status: Offline
|
Chop it from the $_SELF variable?
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
im sure you could get it from the headers?
|
MikeLamb
Member
Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
|
so am i, cant figure it out. I thought $_SELF returned everything after the tld?
|
Tim
Site Administrator
Registered: 21st Apr 00
User status: Offline
|
$ENV{'SERVER_NAME'}
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
just use $_self, then trim it using substr ie:
$a = substr($_SELF, 0, strlen($_SELF) - strlen("*insert script filename etc*));
^ i doubt that will work as im having to do it off the top of my head, but you get the idea 
Only other thing i could suggest is get the header of the server etc, but that will return the main domain name (i believe).
Could just google for an example or use pscode.com mate
|
Tim
Site Administrator
Registered: 21st Apr 00
User status: Offline
|
Sorry, incase you wanted the actual Host: header instead of the webserver's defined hostname, then you can use $_SERVER{'HTTP_HOST'}...
It's not majorly difficult
|
MikeLamb
Member
Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
|
quote: Originally posted by Tim
Sorry, incase you wanted the actual Host: header instead of the webserver's defined hostname, then you can use $_SERVER{'HTTP_HOST'}...
It's not majorly difficult
genius, worked perfectly! Cheers
|