Hacker News new | past | comments | ask | show | jobs | submit login

It's interesting and I like it. It does seem to be rather opinionated without saying so. The PHP example requires an http library I hadn't heard of (rmccue/requests). Copy/paste of that code doesn't work unless you know how to find and install that library. The related tool they reference, however, does work using the PHP curl library.

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).

https://www.php.net/manual/en/book.curl.php




At the time we were using that particular library heavily at WizeHire. I had built the tool for personal convenience. rmccue/requests was likely one of the first "generators".

I expect that we'd accept a PR for PHP curl library implementation. Having a non-third-party option would be valuable.


I am on my phone so I can't contribute a PR right now, but here are tons of PHP examples: https://ntfy.sh/docs/publish/

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 '
    ]
   ]));


Someone contributed a PR that replaced the PHP output with libcurl




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: