/**
* An example of how to assign number.
*
* Copyright (c) 2007, aq Limited
*/
/**
* Provision number to a reseller
* @param string $username reseller's username
* @param string $password reseller's password
* @param string $phoneNumbers phone numbers to be provisioned in the format
* of 44-870-1234567_44-870-1234567_etc_etc
* @param string $firstNames customer's first name
* @param string $lastNames customer's last name
* @param string $emails customer's email
* @return string response code, provisioned number, voip number and password
*/
function assignNumbers($username, $password, $phoneNumbers, $firstNames,
$lastNames, $emails)
{
$gatewayAddr = "http://gw1.aql.com/telecoms/assignnumberapi.php";
$varToSend = "username=".$username."&password=".$password."&phoneNumbers="
.$phoneNumbers."&firstNames=".$firstNames."&lastNames="
.$lastNames."&emails=".$emails;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $gatewayAddr);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // don't do SSL
curl_setopt($ch, CURLOPT_POSTFIELDS, $varToSend); // send the variables
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return response as string
$postResult = curl_exec($ch);
// Print out the curl error messages if there is one.
if (curl_errno($ch))
echo(curl_error($ch));
curl_close ($ch);
return $postResult;
}
// *** Please input the necessary detail here ***
$username = ""; // Your aql username.
$password = ""; // Your aql password.
// phone number to be provisioned, the number should be in the format of
// 44-870-1234567 for a single number or 44-870-1234567_44-870-1234567_etc_etc
// for multiple numbers (the same format returned by the check_avai script)
$phoneNumbers = "";
// Customer first name. In the format of Andrew_Bob_etc_etc for mutiple names
$firstNames = "";
// Customer's last name. In the format of Brown_Smith_etc_etc for mutiple names
$lastNames = "";
// Customer's email address. In the format name@email.com_name2@email2.com_etc
// for multiple entry
$emails = "";
echo(assignNumbers($username, $password, $phoneNumbers, $firstNames,
$lastNames, $emails));