OneSignal Push Notification PHP API

Today, We want to share with you OneSignal Push Notification PHP API.In this post we will show you Create Onesignal Push Notification in PHP, hear for Adding Push Notification in PHP With OneSignal we will give you demo and example for implement.In this post, we will learn about OneSignal Push Notification Send to Specific User in PHP with an example.

OneSignal Push Notification PHP API

There are the Following The simple About OneSignal Push Notification PHP API Full Information With Example and source code.

As I will cover this Post with live Working example to develop Push Notification PHP via Onesignal, so the OneSignal how to send Push to specific device for this example is following below.

onesignal php push notification panel

onesignal features

  • Unlimited Mobile Push
  • Web Push Up to 30K Subscribers
  • Unlimited Segmentation
  • Delivery Scheduling
  • Emojis and Images
  • Localization
  • A/B Testing
  • Real-Time Analytics
OneSignal Push Notification PHP API Examples
OneSignal Push Notification PHP API Examples

Step 1: Include header Part


    onesignal - Register Notification -


Step 2: Include header Part

Ajax Call Save playerId


Step 3: onesignal Add New Subscribers


Step 4: onesignal Send Push Notification Code


 'Welcome To - free Download Source code'
    $beutiful_template_array = array();
    array_push($beutiful_template_array, array(
        "id" => "file-button",
        "text" => "pakainfo",
        "icon" => "",
        "url" => ""
    array_push($beutiful_template_array, array(
        "id" => "file-button-2",
        "text" => "Pakainfo2",
        "icon" => "",
        "url" => ""
    $fields = array(
        'app_id' => "cd9e4242-cd78-9898-b181-0ef50f0jd43d",
        'included_segments' => array(
        'data' => array(
            "foo" => "bar"
        'contents' => $content,
        'web_buttons' => $beutiful_template_array
    $fields = json_encode($fields);
    print("\nJSON sent:\n");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json; charset=utf-8',
        'Authorization: Basic JDKiNzU9PLKtN2M5OS00FJK7LTg6YWYtYTY1OTAzMJS8YzI8'
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    $response = curl_exec($ch);
    return $response;

$results = sendPushNotification();


Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about OneSignal Push Notification PHP API.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment