Currently I have this small script that makes it possible to check if a domain name is free. It works from the browser, when you type check.php?domain=xxxx.com and you see if it is free or not.
Because of $_GET is used it only works from a browser and not from command line.
The PHP manual says that I should use $argv or getopt() to achieve this. I have tried it but then my script stops working.
How can the following code be made to work from command line?
<?php
include_once('/home/xxx/API.php');
$CClient = new XCApi();
$CClient->isAvailable();
$d = $_GET['domain'];
ob_implicit_flush(1);
for ($i = 0; $i < 60000; ++$i) {
$domainResult = $CClient->checkDomainAvailability( new XDomain( $d ) );
if ( $domainResult->getStatus() == "domain_available" ) {
echo $i . ". Domain " . $d . " is free (checked: " . date("Y-m-d H:i:s") . ")<br />";
$_GET['domain'] = $d;
include_once('Register.php');
exit;
}
elseif ( $domainResult->getStatus() == "domain_unavailable" ) {
echo $i . ". Domain " . $d . " is unavailable (checked: " . date("Y-m-d H:i:s") . ")<br />";
}
else {
echo $i . ". Domain " . $d . " is unknown (checked: " . date("Y-m-d H:i:s") . ")<br />";
}
echo"<pre>";
print_r($domainResult);
echo"</pre>";
}
?>