PHP Create CallFire XML Rest API

The following example will create a campaign with the CallFire XML specified. We use curl to set all the http parameters for the Rest call.

<?
    $CF_URL = "https://www.callfire.com/cloud/1/callfirexml/campaign";
    $CF_XML = '<dialplan name="Root"><play name="play" type="tts" voice="male1">Mr. Watson, Come Here, I Want You!</play></dialplan>';

        // Setup your Parameters for an outbound campaign
    $params = array (
        "apikey"            => "XxxxxxxxxxxxxxxxxxxxxxxX",
        "campaignName"      => "Campaign Name",
        "isOutbound"        => "true",
        "outboundCallerid"  => "2132212289",
        "callfireXml"       => $CF_XML
    );

    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: application/x-www-form-urlencoded'));  

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

?>