PHP Send Call Rest API

Sends a call to "PHONENUMBER" and also appends some extra data to the number. The extra information fields can be used for ${call.field.X} variables.

Usage

  1. Replace the {campaignid} with a valid campaignid
  2. Replace the apikey variable with your key
  3. Replace the PHONENUMBER,extra1 section with a number and valid extra information. For example 2132212289,id_213
<?
    $CF_URL = "https://www.callfire.com/cloud/1/campaign/{campaignid}/call";

        // Setup your Parameters for an outbound campaign
    $params = array (
        "apikey"            => "XxxxxxxxxxxxxxxxxxxxxxxX",
        "numbers"      => "PHONENUMBER,extra1"
    );

    print $CF_URL;

    $http = curl_init($CF_URL);
    curl_setopt($http, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($http, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($http, CURLOPT_URL, $CF_URL);
    curl_setopt($http, CURLOPT_POST, true);
    curl_setopt($http, CURLOPT_POSTFIELDS, http_build_query($params));
    curl_setopt($http, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));  

    $resp = curl_exec($http);
    print "<br />Response: ";
    var_dump($resp);
    print "<br />Errors:  ";
    var_dump( curl_error($http) );
    print "<br />";

?>