/ Published in: PHP
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.
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * fetch CSV data from hypovereinsbank Direct B@nking * * @author CU * @version 1.0 * @requires curl in CLI mode */ getHypoData(); /** * retrieves CSV data from hypovereinsbank Direct B@nking 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("\n", $output)."\n") || 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 ?>
URL: http://www.hypovereinsbank.de