PHP
Send Message via REST API
php
<?php
$data = [
"dock_id" => "<Dock ID>",
"secret_key" => "<Secret Key>",
"msg" => "Hello from PHP!"
];
$options = [
"http" => [
"method" => "POST",
"header" => "Content-Type: application/json\r\n",
"content" => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents("https://api.pingdock.io/ping", false, $context);
echo $result;Send Message via Webhook
php
<?php
$data = ["msg" => "Webhook from PHP!"];
$auth = base64_encode("<Dock ID>:<Secret Key>");
$options = [
"http" => [
"method" => "POST",
"header" => "Authorization: Basic $auth\r\nContent-Type: application/json\r\n",
"content" => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents("https://api.pingdock.io/webhook", false, $context);
echo $result;