examples/publish-php/publish.php
raw| 1 | <?php |
| 2 | |
| 3 | // Check out https://ntfy.sh/phil_alerts in your browser after running this. |
| 4 | file_get_contents('https://ntfy.sh/phil_alerts', false, stream_context_create([ |
| 5 | 'http' => [ |
| 6 | 'method' => 'POST', // PUT also works |
| 7 | 'header' => |
| 8 | "Content-Type: text/plain\r\n" . |
| 9 | "Title: Unauthorized access detected\r\n" . |
| 10 | "Priority: urgent\r\n" . |
| 11 | "Tags: warning,skull", |
| 12 | 'content' => 'Remote access to phils-laptop detected. Act right away.' |
| 13 | ] |
| 14 | ])); |