I need to use the SoapClient PHP function to use a service from another site that will give me a certain information.
Can they know from what site came that request?
Thank you all.
Yes, if you put this code (example)
function get_base_domain_by_name ( $name ) {
if (is_string($name) && preg_match('/^[a-z0-9\-\.]+\.[a-z0-9\-]+$/i', $name) === 1) {
$parts = array_reverse(explode('.', strtolower($name)));
$base = array_shift($parts);
foreach ($parts as $part ) {
$base = $part.'.'.$base;
if (( $addr = gethostbyname($base) ) != $base && preg_match('/^[0-9\.]+$/', $addr) === 1 ) {
return($base);
}
}
}
return(false);
}
function get_base_domain_by_addr ( $addr ) {
return(get_base_domain_by_name(gethostbyaddr($addr)));
}
$domain = get_base_domain_by_addr($_SERVER['REMOTE_ADDR']);
echo $domain;
You can get the URL of the of the Site that accessed you, and if you use: $_SERVER['REMOTE_ADDR'] you can get the IP Address.