skpy/Namecheap-REST-PHP — comment on commit fe7076765dca7f45ade2ab7e3f872f9d3f1658b0
File: README line 32
By skpy:

The error indicates that you're not passing an array to the foreach() loop.

The domainCheck() method accepts either a single domain (as a string), or an array of domains. If you supply a single domain string, then domainCheck() will return a boolean value for whether that domain is available.

If you supply an array of domain names, then domainCheck() will return an associative array of name => status pairs.

Also, if communication with NameCheap fails for any reason, then domainCheck() will return boolean false regardless of what you supplied.

Without knowing what you're supplying to domainCheck(), I can't provide specific guidance.

Here's another example:
// build an array of domains to check
$domains_to_check = array( 'example.net', 'example.org', 'example.info' );
// send the array to domainCheck() and capture the response
$results = $nc->domainCheck( $domains_to_check );
// check the response: we're expecting an associative array but need to properly deal with communication failures
if ( FALSE === $results ) {
// boolean FALSE means there was an error communicating with NameCheap. Display a helpful error message to the user
die( "Whoops, sorry. NameCheap isn't taking out calls right now. Try again later, mkay?" );
}
// if we got here, then $results should be an associative array.
foreach ( $results as $domain => $status ) {
// loop over the domains we want to check, and do whatever we need to do.
}