public function login($credentials)
{
$this->_user = $credentials['user'];
$password = $credentials['password'];
$this->_apiPassword = $credentials['apipassword'];
$this->_client = new \Oara\Curl\Access($credentials);
$loginUrl = 'https://www.paidonresults.com/login/';
$valuesLogin = array(new \Oara\Curl\Parameter('username', $this->_user), new \Oara\Curl\Parameter('password', $password));
$urls = array();
$urls[] = new \Oara\Curl\Request($loginUrl, $valuesLogin);
$this->_client->post($urls);
$urls = array();
$urls[] = new \Oara\Curl\Request('http://affiliate.paidonresults.com/cgi-bin/home.pl', array());
$exportReport = $this->_client->post($urls);
if (!\preg_match('/http\\:\\/\\/affiliate\\.paidonresults\\.com\\/cgi\\-bin\\/logout\\.pl/', $exportReport[0], $matches)) {
throw new \Exception("Error on login");
}
if (\preg_match("/URL=(.*)\"/", $exportReport[0], $matches)) {
$urls = array();
$urls[] = new \Oara\Curl\Request($matches[1], array());
$this->_client->get($urls);
}
}