Blog

Sample Broadcast API Code in PHP

Sample Broadcast API Code in PHP

Below is the sample broadcast API code is PHP, please replace the JSON data with your own data and submit

<?php

    //--API PARAMETERS ENCODED AS JSON--
    $JSON_DATA = '{"token":"API_TOKEN_XXXXXXX","priority ":0,"application":"1","sleep":0,"globalmessage":"test","globalmedia":"","data":[{"number":"MOBILE_NUMBER_1_WITH_COUNTRY_CODE","message":""},{"number":"MOBILE_NUMBER_2_WITH_COUNTRY_CODE","message":""}]}';
  

    //--CURL FUNCTION TO CALL THE API--
    $url = 'http://pickyassist.com/app/api/v2/push';

    $ch = curl_init($url);                                                                      
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
    curl_setopt($ch, CURLOPT_POSTFIELDS, $JSON_DATA);                                                                  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: application/json',                                                                                
        'Content-Length: ' . strlen($JSON_DATA))                                                                       
    );                                                                                                                   
                                                                                                                            
    $result = curl_exec($ch);

    //--API RESPONSE--
    print_r( json_decode($result,true) );


?>

 

Leave a Reply


Your email address will not be published. Required fields are marked *

Related Posts


July 21, 2019

What is Intents in Smart Replies ?

Intents (beta) Available only for beta testers  Intent helps Smart Replies to identify the topic which your users are asking , add keywords which are most relevant to the specific topic in which questions are related in a category , dont add questions as intents. Now let’s see how intent works ? Do you have

June 6, 2019

Adding Widget Into WordPress

Adding Widget Into WordPress In this guide we will show how can add Picky Assist Chat Widget into a WordPress site in less than 5 minute. Watch Video Login into your WordPress Admin Account From the sidebar menu locate “Appearance” menu and click on it and from sub menu select “Editor” Editor may prompt for