PHP notifications when a web page is visited

Basic Script to alert of an event a visit to a page etc,

If you wish to be alerted every time a visitor has opened your page,

Create a .PHP file and add the below code , remembering to edit contents to suit your needs (email addresses etc)  and if you wish to send an email event to Prowl for notication and prowl api email. 

once tested it is safe to remove all lines which start with "//" if you wish.

Example:-- Stripe Webhook wiil send your stripe event to your strpe php address.  "Stripe-File".php url ( https://www.mydomain.com/stripe-file.php )

            :- If you wish to be alerted of search engine bot visits call this bots.php and place it in your public webpage area.
      
            :- if you use stripe your stripe php below will redirect this to your desired email, BUT PLACE IT somewhere out of public access and direct stripe hooks directly to the pages address! Basic, no major detail just a notification that something has occurred. If you send the email to one of your Prowl API addresses you will get instant notifications via prowl on your set devices. If you put this in a public area all visits will create an alert, you will probably get sick of this eventually.

This does nothing but send a notication that a visit has occured to this page. you will also get robots alerting you if this page is in a public directory. 

// Retrieve the request and parse it prowl notifictation
// Do something code with php below

http_response_code(200); // PHP 5.4 or greater


// edit email address to send to =
// change subject matter and message as required
// change reply to and headers as you wish
// you may add as many recipients as to wish, just copy and add
another $to line 

<?php
$to = 'nobody@example.com';
$subject = 'Stripe\Event\Robot';
$message = 'Robots have visited us';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
  • php mail, php page visited notification, page visit alert, robot
  • 0 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?

Related Articles

TONIDO

FEATURES HOW IT WORKS PRICING DOWNLOADS PRESS TONIDO DESKTOP FOR BUSINESS...

TONIDO BIZZ

  $99.00 TonidoPro is subscription software...

HP I3 DESKTOP

HP Compaq Pro 6300 C9J97UT#ABA Desktop PC - 3rd Gen. Intel Core i3-3240 3.4GHz, 6GB DDR3,...

EYE FI CARDS

Like this product? Help spread the word:      $59.00       Overview...

NEW SKYDOCK DOCUMENT / DATA STORAGE

Skydock Cloud Pricing We have a range of rates to meet your needs, as well as...