by codazoda · 4y ago · 0 comments
I presume they were trying to keep the code to 4 lines or so. The curl library in PHP is rather verbose and requires 5 to 8 lines (depending on if you try to catch the error).
I expect that we'd accept a PR for PHP curl library implementation. Having a non-third-party option would be valuable.
Also check the other pages on the docs.
Here's one example:
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([
'http' => [
'method' => 'POST', // PUT also works
'header' => 'Content-Type: text/plain',
'content' => 'Backup successful '
]
]));