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

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

Check the connection
public checkConnection ( )
    public function checkConnection()
    {
        //If not login properly the construct launch an exception
        $connection = true;
        $url = "https://assoc-datafeeds-eu.amazon.com/datafeed/listReports";
        $curl = \curl_init();
        \curl_setopt($curl, CURLOPT_URL, $url);
        \curl_setopt($curl, CURLOPT_USERPWD, $this->_credentials["user"] . ':' . $this->_credentials["password"]);
        \curl_setopt($curl, CURLOPT_HEADER, false);
        \curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        \curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        \curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        \curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        \curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
        $output = \curl_exec($curl);
        if (\preg_match("/Error/", $output)) {
            $connection = false;
        }
        return $connection;
    }