Oara\Network\Publisher\PrivateInternetAccess::checkConnection PHP Метод

checkConnection() публичный Метод

public checkConnection ( ) : boolean
Результат boolean
    public function checkConnection()
    {
        $connection = true;
        $valuesFormExport = array();
        $urls = array();
        $urls[] = new \Oara\Curl\Request('https://www.privateinternetaccess.com/affiliates/affiliate_dashboard', $valuesFormExport);
        $exportReport = $this->_client->get($urls);
        $doc = new \DOMDocument();
        @$doc->loadHTML($exportReport[0]);
        $xpath = new \DOMXPath($doc);
        $results = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " login ")]');
        if ($results->length > 0) {
            $connection = false;
        }
        $urls = array();
        $urls[] = new \Oara\Curl\Request('https://www.privateinternetaccess.com/affiliates/affiliate_help', $valuesFormExport);
        $exportReport = $this->_client->get($urls);
        \preg_match_all("/access_token.=(.+).&date/", $exportReport[0], $matches);
        $this->_apikey = $matches[1][1];
        return $connection;
    }