Hypo CSV爬虫-网上银行对账单下载从Hypovereinsbank慕尼黑,德国使用P
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hypo CSV爬虫-网上银行对账单下载从Hypovereinsbank慕尼黑,德国使用P相关的知识,希望对你有一定的参考价值。
updated 2013-04-18!just replace the XXX fields with your own numbers. Then run this php Script from the command line (CLI mode). It will fetch the online statements from Hypovereinsbank direct banking.
The code works by tweaking CURL settings around the HTTPS connection.
<?php /** * fetch CSV data from hypovereinsbank Direct [email protected] * * @author CU * @version 1.0 * @requires curl in CLI mode */ getHypoData(); /** * retrieves CSV data from hypovereinsbank Direct [email protected] website. * @return boolean successful or not * @access public * @static makes the class property accessible without needing an instantiation of the class */ function getHypoData() { # CONFIG $sleepMin = 5; $sleepMax = 10; # $proxyCfg = ' -x XXX.XXX.XXX.XXX:XXXX'; $direktbankingNr = 'xxxxxxxxxxx'; $pwdOnline = 'xxxxxxxxx'; # CONFIG # to use strftime's magic $curlParameters = $proxyCfg. ' --silent --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" -b cookies_hypo.txt -c cookies_hypo.txt --location'; # to debug CURL simply uncomment next line # $curlParameters = ' --include --trace-ascii debugdump0.txt '.$proxyCfg.' --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" -b cookies_hypo.txt -c cookies_hypo.txt --location'; } $run = exec('curl https://my.hypovereinsbank.de/login?view=/privatkunden/login.jsp '. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } print "FATAL: buggy input. "; return false; } $ViewState = ''; # find the "ViewState" foreach ($output as $line) { if ($ViewState = $challenge_line[7]) { } } } return false; } $run = exec('curl https://my.hypovereinsbank.de/login?view=/privatkunden/login.jsp --data "username='. $direktbankingNr .'&px2='. $pwdOnline .'&secP=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF&fp=&directBankingLoginForm%3AloginPanel%3AloginCommand=Anmelden&directBankingLoginForm%3A_idcl=&directBankingLoginForm%3A_link_hidden_=&directBankingLoginForm_SUBMIT=1&javax.faces.ViewState='. $ViewState .'"'. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } return false; } $run = exec('curl https://my.hypovereinsbank.de/portal?view=/banking/accountManagement.jsp '. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } return false; } $ViewState = ''; # find the changed "ViewState" foreach ($output as $line) { if ($ViewState = $challenge_line[13]) { } } } return false; } $run = exec('curl https://my.hypovereinsbank.de/portal?view=/banking/accountManagement.jsp --data "accountManagement%3AdayFrom=1&accountManagement%3AmonthFrom='. $fromMonth .'&accountManagement%3AdayTo='. $toDay .'&accountManagement%3AmonthTo='. $toMonth .'&accountManagement%3AnumberOfTurnovers=9999&accountManagement%3Arefresh=Anzeigen&accountManagement%3Apurpose=&accountManagement%3AamountMin=&accountManagement%3AamountMax=&accountManagement%3A_link_hidden_=&accountManagement%3A_idcl=&accountManagement_SUBMIT=1&&javax.faces.ViewState='. $ViewState .'"'. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } return false; } # fetch live & old Kontostand $liveStart = false; foreach ($output as $line) { $liveStart = true; } $liveStart = false; } } } if ($lineParts2[1]) { $Betrag[1] = $lineParts2[1]; } else { } } } if (!$Betrag) { print 'no Betrag in line: '. __LINE__; return false; } $run = exec('curl https://my.hypovereinsbank.de/portal?view=/banking/accountManagement.jsp --data "accountManagement%3AdayFrom=1&accountManagement%3AmonthFrom='. $fromMonth .'&accountManagement%3AdayTo='. $toDay .'&accountManagement%3AmonthTo='. $toMonth .'&accountManagement%3AnumberOfTurnovers=9999&accountManagement%3Apurpose=&accountManagement%3AamountMin=&accountManagement%3AamountMax=&accountManagement%3AbuttonNavigation%3Aj_id_id182=Download+Kontoums%E4tze+&accountManagement%3A_link_hidden_=&accountManagement%3A_idcl=&accountManagement_SUBMIT=1&&javax.faces.ViewState='. $ViewState .'"'. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } return false; } if ($output) { $result = file_put_contents($fileName, implode(" ", $output)." ") || die (print "could not dump CSV content to file"); } $run = exec('curl https://my.hypovereinsbank.de/login?view=/privatkunden/logout.jsp '. $curlParameters, $output); if (!$run) { print "could not execute CURL line ". __LINE__; return false; } return false; } return true; } return false; } // end func # EOF ?>
以上是关于Hypo CSV爬虫-网上银行对账单下载从Hypovereinsbank慕尼黑,德国使用P的主要内容,如果未能解决你的问题,请参考以下文章