protected function getApiEndpoint()
    {
        $servers = array();
        if ($this->options['sandbox']) {
            $servers[] = self::SANDBOX_SERVER;
        } else {
            $servers = array(self::MAIN_SERVER, self::BACKUP_SERVER);
        }

        foreach ($servers as $server) {
            $doc = new \DOMDocument();
            $doc->loadHTMLFile('https://'. $server . "/load.html");

            $element = $doc->getElementById('server_status');
            if ($element && 'OK' == $element->textContent) {
                return $server;
            }
        }

        throw new RuntimeException('No server available.');
    }
protected function getApiEndpoint()
    {
        $servers = array();
        if ($this->options['sandbox']) {
            $servers[] = self::SANDBOX_SERVER;
        } else {
            $servers = array(self::MAIN_SERVER, self::BACKUP_SERVER);
        }

        foreach ($servers as $server) {
            $doc = new \DOMDocument();
            $doc->loadHTMLFile('https://'. $server . "/load.html");

            $element = $doc->getElementById('server_status');
            if ($element && 'OK' == $element->textContent) {
                return $server;
            }
        }

        throw new RuntimeException('No server available.');
    }
protected function getApiEndpoint ( ) { $ servers = array ( ) ; if ( $ this -> options [ 'sandbox' ] ) { $ servers [ ] = self :: SANDBOX_SERVER ; } else { $ servers = array ( self :: MAIN_SERVER , self :: BACKUP_SERVER ) ; } foreach ( $ servers as $ server ) { $ doc = new \ DOMDocument ( ) ; $ doc -> loadHTMLFile ( 'https://' . $ server . "/load.html" ) ; $ element = $ doc -> getElementById ( 'server_status' ) ; if ( $ element && 'OK' == $ element -> textContent ) { return $ server ; } } throw new RuntimeException ( 'No server available.' ) ; }
Get api end point.
@return string server url
@throws RuntimeException if no server available
Get api end point .