I have problem with getting domain name using HTTP_REFERER.
The condition is like this:
http://www.example.com send a curl post to my server. The things is, example.com does not send their url in curl_setopt(CURLOPT_REFERER)
. So is it possible on my server side to get their domain name ?
Thanks a lot for helping me
My code so far:
on abc.com side
$data = array('username' => $username ,
'email' => $email,
'phone' => $phone );
$string = http_build_query($data);
// For debugging purpose
// echo $string;
$ch = curl_init("http://localhost/test/str_pos.php");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
header("Location: str_pos.php");
On my server side:
$domain = parse_url($_SERVER['HTTP_REFERER']);
if (isset($domain['host'])) {
echo $domain['host'];
}
else{
echo "No host found";
}