public function login($credentials)
{
$this->_credentials = $credentials;
$this->_client = new \Oara\Curl\Access($this->_credentials);
$loginUrl = 'http://affiliates.totalvpn.com/login';
$urls = array();
$urls[] = new \Oara\Curl\Request($loginUrl, array());
$exportReport = $this->_client->get($urls);
$doc = new \DOMDocument();
@$doc->loadHTML($exportReport[0]);
$xpath = new \DOMXPath($doc);
$hidden = $xpath->query('//form[@action="/login"]/descendant::input[@type="hidden"]');
$valuesLogin = array(new \Oara\Curl\Parameter('username', $credentials['user']), new \Oara\Curl\Parameter('password', $credentials['password']));
foreach ($hidden as $values) {
$valuesLogin[] = new \Oara\Curl\Parameter($values->getAttribute("name"), $values->getAttribute("value"));
}
$loginUrl = 'http://affiliates.totalvpn.com/login';
$urls = array();
$urls[] = new \Oara\Curl\Request($loginUrl, $valuesLogin);
$this->_client->post($urls);
}