To send yourself a push notification from PHP, make one request to your Hook.Notifier URL. A few lines of curl and your phone rings.
<?php
$ch = curl_init("https://hooknotifier.com/{IDENTIFIER}/{KEY}");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"object" => "New order",
"body" => "You just made a sale",
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
The short version
If you just need a quick ping and do not need the response, a one-liner works too.
<?php
file_get_contents("https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Done&body=" . urlencode("The script finished"));
Inside WordPress
Since it is a plain request, you can drop it into any hook. Here it fires when an order is placed.
add_action('woocommerce_new_order', function ($order_id) {
file_get_contents("https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=New%20order&body=Order%20{$order_id}");
});
Priorities and live updates
Two parameters worth knowing. priority (low, normal, high, critical) decides how loud the ping is: low skips the phone push, high and critical cut through quiet hours. And the send returns an id you can PUT back to, updating the notification in place instead of stacking new ones.
<?php
// Send returns {"status":"ok","id":42}
$res = json_decode(file_get_contents(
"https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Import&body=Import%20started&priority=low"
), true);
// ... run the import ...
// Update the same notification in place
$ch = curl_init("https://hooknotifier.com/{IDENTIFIER}/{KEY}/" . $res["id"]);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"object" => "Import",
"body" => "Done, 4210 rows imported",
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Add markdown=true and the body renders as markdown, bold, lists, links and all.
First get your URL
Your Hook.Notifier URL is https://hooknotifier.com/{IDENTIFIER}/{KEY}. Create a free account to get yours, then drop it into your script.
Why it matters
PHP runs the web behind a lot of stores and sites. A few lines turn any event on your server, an order, a form, a cron task, into a notification on your phone the moment it happens.
New to this? Start with how to send yourself a native push notification.


