Contents |
The source code below provides an easy way to integrate CallFire via a web signup form. It takes the form data, adds the number to an existing campaign and then sends that number a confirmation call.
<?php
//Created by: Punit Shah
//Callfire.com
//techsupport@callfire.com
$campaignid = 104999995; // put your campaign id here
$key = "b9dd3sdfsd38c93sdfsdggbb67e67d1"; // put your key here
$number = $_REQUEST['custom_phone']; // This should stay the ame
$name = $_REQUEST['category2']; // This could be extra data
$email = $_REQUEST['category3']; // like name, address etc.
// create the data string
$moreData = array ($number , $name , $email);
// toggle debugging output (more verbose)
$debug = true;
// open file name
require_once('nusoap/lib/nusoap.php');
$debug=true;
$stdlog = fopen("callfire.log", "a");
$wsdl = "https://www.callfire.com/service/CampaignService?wsdl";
$client = new soapclient($wsdl, true);
$err = $client->getError();
if ($err) {
// Display the error
fputs($stdlog, "Constructor error:" . $err . "\n");
// At this point, you know the call that follows will fail
}
/* create the proxy object */
$proxy = $client->getProxy();
/* call readLS */
// Let NuSoap extract the correct target namespace
// and name param from the WSDL
$param = array('key' => $key, 'campaignId'=> $campaignid, 'number'=> $number, 'moreData' => $moreData);
$result = $proxy->sendCallForCampaign($param);
if ($debug)
{
printf($stdlog, "FAULT: code: {$proxy->faultcode}\n");
printf($stdlog,"FAULT: String: {$proxy->faultstring}\n");
printf($stdlog,"Request: ");
printf($stdlog,"".htmlspecialchars($proxy->request, ENT_QUOTES)."\n");
printf($stdlog,"Response: ");
printf($stdlog,"".htmlspecialchars($proxy->response, ENT_QUOTES)."\n");
printf($stdlog,"Result:".print_r($result,true)."\n");
}
fclose($stdlog);
// replace with the destination you would want to take the
// visitor after they've
header( 'Location: http://www.<YourDomain>.com' ) ;
?>
