Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:58:24+00:00 2026-06-03T16:58:24+00:00

Currently I have this small script that makes it possible to check if a

  • 0

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>";
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:58:26+00:00Added an answer on June 3, 2026 at 4:58 pm

    Change

    $d = $_GET['domain'];
    

    to:

    $d = $argv[1];
    

    …and call it at the command line like this:

    php /path/to/script.php "www.domaintocheck.com"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a small Python script that I'm using to spawn multiple executables,
I currently have this useful code that I found elsewhere on StackOverflow: form.DrawToBitmap(bmp, new
I'm currently writing a small script using pygame, but I don't believe this question
I'm currently working on a small script that needs to use gtk.StatusIcon() . For
I have a small vim script that queries Google to insert links in markdown-formatted
I currently have a very basic JQuery script accompanied by some CSS that helps
I currently have this data in a sheet Col A Col B 1 angry
I currently have this working but it requires me to have a static method
I currently have this statement in my SQL View (SQL Server 2008 R2) which
I currently have this method: -(void)seperateGuides { DLog(GetGuideListCount: %i, [[appDelegate getGuideList] count]); columnOneArray =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.