public function login($credentials)
{
$user = $credentials['user'];
$password = $credentials['password'];
$this->_client = new \Oara\Curl\Access($credentials);
$urls = array();
$urls[] = new \Oara\Curl\Request('http://www.bet365affiliates.com/ui/pages/affiliates/affiliates.aspx', array());
$exportReport = $this->_client->get($urls);
$valuesLogin = array(new \Oara\Curl\Parameter('txtUserName', $user), new \Oara\Curl\Parameter('txtPassword', $password), new \Oara\Curl\Parameter('ctl00%24MasterHeaderPlaceHolder%24ctl00%24userNameTextbox', $user), new \Oara\Curl\Parameter('ctl00%24MasterHeaderPlaceHolder%24ctl00%24passwordTextbox', $password), new \Oara\Curl\Parameter('ctl00%24MasterHeaderPlaceHolder%24ctl00%24tempPasswordTextbox', 'Password'), new \Oara\Curl\Parameter('ctl00%24MasterHeaderPlaceHolder%24ctl00%24goButton.x', '19'), new \Oara\Curl\Parameter('ctl00%24MasterHeaderPlaceHolder%24ctl00%24goButton.y', '15'));
$forbiddenList = array('txtPassword', 'txtUserName');
$doc = new \DOMDocument();
@$doc->loadHTML($exportReport[0]);
$xpath = new \DOMXPath($doc);
$hiddenList = $xpath->query('//input[@type="hidden"]');
foreach ($hiddenList as $hidden) {
if (!in_array($hidden->getAttribute("name"), $forbiddenList)) {
$valuesLogin[] = new \Oara\Curl\Parameter($hidden->getAttribute("name"), $hidden->getAttribute("value"));
}
}
$loginUrl = 'https://www.bet365affiliates.com/Members/CMSitePages/SiteLogin.aspx?lng=1';
$urls = array();
$urls[] = new \Oara\Curl\Request('http://www.bet365affiliates.com/ui/pages/affiliates/affiliates.aspx', array());
$this->_client->post($loginUrl, $valuesLogin);
}