asked on
function getClient() {
$client = new SoapClient('http://url:8080/SKS1A/SKS1A?wsdl');
// is soapcookies already set? (must be already logged in)
if (isset($_SESSION['soapcookies']))
{
// just set the cookies
foreach ($_SESSION['soapcookies'] as $cookiename => $value)
$client->__setCookie($cookiename, $value[0]);
}
else {
//please change the username and password
$result = $client->login(array('username' => $username, 'password' => $password))->return;
//print_r($result);
//store the soap cookies in $_SESSION so that don't need to reauthenticate.
$_SESSION['soapcookies'] = $client->_cookies;
}
return $client;
}
$query = "SELECT id,domainname from domain WHERE status='check'";
$data = mysql_query($query, $conn) or die();
echo "Cron Check Start<br>";
while($rec = mysql_fetch_array($data))
{
//get the SOAP client connection
$api = getClient();
$domain = $rec[domainname];
$arg0 = $reseller;
$arg1 = $domain; //sample result available
$result = $api->checkDomainAvailability(array('arg0' =>$arg0,'arg1' =>$arg1))->return;
$xml = new SimpleXMLElement($result);
$result = $xml->code;
$description = $xml->reason;
if($result == 1000) { echo "Domain $domain successfully checked<br>"; }
else { echo "Domain: '".$rec[domainname]."' '".$description."' ERROR<br>"; }
}// end while.