There was a task to send alerts to iphone. Of course, it would be easier to do this with regular email, but the client insisted on pushing it. So I had to use the search. To my surprise, neither on Habré nor in the Russian part of the Internet there was a working example of how to make a free push. It would be necessary to fix it.
We will need to install the free Boxcar 2 application, as well as in our script there should be support for CURL.

')
Under the cat is a step by step guide and an example in php.
Step 1. Install on iphone
Boxcar 2 .
Step 2. Take Access Token from the settings
- We go in the application in Settings
- Scroll down to the item with the same name: Access token and copy
- Here you can see in pictures
Step 3. In our script, add the following CURL command:
curl -d "user_credentials=ACCESS_TOKEN" \
-d "notification[title]=message title" \
-d "notification[long_message]= Some text or HTML for the full layout page notification " \
-d "notification[sound]=bird-1" \
-d "notification[source_name]=My own alert" \
new.boxcar.io/api/notifications
Parameters have the following meanings:
- user_credentials - your Access token from p.2
- title - message title
- long_message - message body. Supports HTML
- sound. If not filled, it will come without sound. Possible values are in the help.
- source_name is the name of the source. Personally, I put the name of the site
It is clear that it is necessary to write programming in your language. For example, this is how it looks in php:
function boxcar($title,$message){ curl_setopt_array( $curl = curl_init(), array( CURLOPT_URL => "https://new.boxcar.io/api/notifications", CURLOPT_POSTFIELDS => array( "user_credentials" => ' Access Token', "notification[title]" => $title, "notification[long_message]" => $message, "notification[sound]" => "bird-1", "notification[source_name]" => "test" ))); $ret = curl_exec($curl); curl_close($curl); return $ret; } boxcar('Hello World','The world is mine! <b>He-he-he</b>');
In fact, this is a translation of an example from a
reference , but I hope someone will save time when searching.