/**
* An example of how to do http post on our available numbers gateway.
*
* Copyright (c) 2007, aq Limited
*/
/**
* Query available numbers from aq.
* @param string $username reseller's username
* @param string $password reseller's password
* @param string $country country code to be queried
* @param string $areaCode area code to be queried
* @param string $subCode phone number to be queried, allows * as wildcard
* @return string response code and the available numbers (please refer to the
* API for more info.
*/
function queryAvaiNumbers($username, $password, $country, $areaCode, $subCode)
{
$gatewayAddr = "http://gw1.aql.com/telecoms/checknumberapi.php";
$varToSend = "username=".$username."&password=".$password."&country="
.$country."&areaCode=".$areaCode."&subCode=".$subCode;
$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;
}
// Input your information here
$username = ""; // Your aql username.
$password = ""; // Your aql password.
$country = "44"; // Only UK (ie. 44) is currently available.
$areaCode = "871"; // Area code without the leading 0 (eg. 113 for Leeds,etc)
$subCode = "312007*"; // Sub code. Note: wildcard is permitted, please refer
// to the API for more information
echo( queryAvaiNumbers($username,$password,$country,$areaCode,$subCode) );