Make this code only execute once per visitor, help appreciated

mphp

New member
Hi I am using this code in my index.php to send myself android notification about what sites are referring visitors to my website.
Issue I have is that I usually get 2 even 3 notification per visitor sometimes.
Is there any way to edit this code so that it only send 1 notification per referrer?

Code:
if (!empty($_SERVER['HTTP_REFERER'])) {               
    $refer = $_SERVER['HTTP_REFERER'];
}

$word1 = "google.";

if (!empty($refer) and !strpos($refer, $word1)) {
  
        // Target URL
    $url = "https://xdroid.net/api/message?k=k-8278286d&t=FROM&c={$refer}&u={$refer}";
      
        // Fetching headers, aka visit/ping $url above
    $headers = get_headers($url);
}
 
Back
Top