wykonując skrypt
<?
$hand = curl_init();
$url = 'https://www.mbank.com.pl/logon.aspx';
curl_setopt($hand, CURLOPT_URL, $url);
curl_setopt($hand, CURLOPT_HEADER, 1);
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0");
curl_setopt($hand, CURLOPT_REFERER, 'https://www.mbank.com.pl/logon.aspx');
curl_setopt($hand, CURLOPT_COOKIESESSION, 1);
curl_setopt
($hand, CURLOPT_COOKIEJAR
, dirname(__FILE__) . '/tmp0');$site = curl_exec($hand);
curl_close($hand);
$localDT = '';
$customer = '12345678';
$password = '00000000';
$sCounter = '';
$__VIEWSTATE = '';
$__PARAMETERS = '';
$date = date("d F Y H:i:s"); $seed = preg_replace("!.*<input type=\"hidden\" name=\"seed\" id=\"seed\" value=\"(.*?)\" />.*!is", '$1', $site); $__STATE = preg_replace("!.*<input type=\"hidden\" name=\"__STATE\" id=\"__STATE\" value=\"(.*?)\" />.*!is", '$1', $site); $__EVENTVALIDATION = preg_replace("!.*<input type=\"hidden\" name=\"__EVENTVALIDATION\" id=\"__EVENTVALIDATION\" value=\"(.*?)\" />.*!is", '$1', $site); $post = '__EVENTVALIDATION=' . urlencode($__EVENTVALIDATION) . '&__PARAMETERS=&__STATE=' . urlencode($__STATE) . '&__VIEWSTATE&customer=' . urlencode($customer) . '&localDT=' . urlencode($date) . '&password=' . urlencode($password) . '&sCounter=1&seed=' . urlencode($seed);
$hand = curl_init();
curl_setopt
($hand, CURLOPT_HTTPHEADER
, array( 'Host: www.mbank.com.pl',
'User-Agent: Mozilla/5.0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: pl,en-us;q=0.7,en;q=0.3',
'Accept-Encoding: gzip,deflate',
'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7',
'Keep-Alive: 300',
'Connection: keep-alive',
'Referer: <a href="https://www.mbank.com.pl/'" target="_blank">https://www.mbank.com.pl/'</a>
)
);
curl_setopt($hand, CURLOPT_URL, 'https://www.mbank.com.pl/logon.aspx');
curl_setopt($hand, CURLOPT_POST, 1);
curl_setopt($hand, CURLOPT_POSTFIELDS, $post);
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt
($hand, CURLOPT_COOKIEFILE
, dirname(__FILE__) . '/tmp0');curl_setopt
($hand, CURLOPT_COOKIEJAR
, dirname(__FILE__) . '/tmp1'); $site = curl_exec($hand);
curl_close($hand);
?>
otrzymuję:
Cytat
Błąd systemu
Alarm bezpieczeństwa!
czy możliwe jest zalogowanie się do mBanku poprzez CURL i pobranie tylko salda eKonta?
Ten post edytował rybosom 9.11.2009, 19:42:01