opensrs\FastLookup::checkDomainBunch PHP Method

checkDomainBunch() public method

public checkDomainBunch ( $domain, $tlds )
    public function checkDomainBunch($domain, $tlds)
    {
        if (!$this->init_socket()) {
            throw new APIException('oSRS Error - Unable to establish socket: (' . $this->_socketErrorNum . ') ' . $this->_socketErrorMsg);
        }
        // check to see if the domain has a "." in it, if it does then take everything before the dot as the domain
        // This is if someone puts in a domain name instead of just a name
        if (preg_match("/(^.+)\\.(.+)\\.(.+)/", $domain, $matches) > 0) {
            $domain = $matches[1];
        } elseif (preg_match("/(^.+)\\.(.+)/", $domain, $matches) > 0) {
            $domain = $matches[1];
        }
        // Send a check call
        $resultArray = array();
        foreach ($tlds as $tld) {
            // check_domain / contact_info / update_all_info
            $callCheck = 'check_domain ' . $domain . $tld;
            $callLength = strlen($callCheck);
            /* Commented by BC : NG : 1-12-2014 : To solve issue in fast look up */
            //echo $callCheck . "<br/>";
            /* End : To solve issue in fast look up */
            fputs($this->_socket, $callCheck, $callLength);
            //			// wait 0.25 sec - Immediate socket read will result for wait loops and longer response
            //			usleep(250000);
            // Read result hand for parsing
            $result = fread($this->_socket, 1024);
            $checkRes = $this->parseResult($result);
            // Sort out the results
            $loopAray = array();
            $loopAray['domain'] = $domain;
            $loopAray['tld'] = $tld;
            $loopAray['result'] = $checkRes;
            // Final push
            array_push($resultArray, $loopAray);
        }
        // Close the socket
        $this->close_socket();
        // And there you go!!  That's it
        return $resultArray;
    }