get account balances from bank Web site?

Aaron Vegh aaronvegh-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Aug 4 03:11:13 UTC 2005


Hi Franco,
Thanks very much for this very informative script. I'm not very good
with perl (more a PHP guy, so I'm not completely lost!), so this
really helped.

However, due to my ignorance I have not been able to finish this
script, so I was hoping for a little expertise to push me the final
few steps.

I have five accounts that I would like to get the balances of, and
have written a loop that goes through the source code of the site
using HTML::TokeParser. The code looks like this:

my $stream = HTML::TokeParser->new(\$mech->{content});
while ($stream->get_tag("a")) {
	if (rindex($stream->get_trimmed_text("/a"), $savingsacct) > 0) {
		$stream->get_tag("td"); $stream->get_tag("td"); $stream->get_tag("td");
		print "Savings Account: " . $stream->get_trimmed_text("/td") . "\n";
	}
	elsif (rindex($stream->get_trimmed_text("/a"), $chequingacct) > 0) {
		$stream->get_tag("/td"); $stream->get_tag("/td"); $stream->get_tag("td");
		print "Chequing Account: " .  $stream->get_trimmed_text("/td") . "\n";
	}
	elsif (rindex($stream->get_trimmed_text("/a"), $dreamacct) > 0) {
		$stream->get_tag("/td"); $stream->get_tag("/td"); $stream->get_tag("td");
		print "Dream Account: " .  $stream->get_trimmed_text("/td") . "\n";
	}
	elsif (rindex($stream->get_trimmed_text("/a"), $caracct) > 0) {
		$stream->get_tag("/td"); $stream->get_tag("/td"); $stream->get_tag("td");
		print "Car Account: " .  $stream->get_trimmed_text("/td") . "\n";
	}
	elsif (rindex($stream->get_trimmed_text("/a"), $locacct) > 0) {
		$stream->get_tag("/td"); $stream->get_tag("/td"); $stream->get_tag("td");
		print "Line of Credit: " . $stream->get_trimmed_text("/td") . "\n";
	}
}

The result is, the script outputs the balance for the first account in
this loop ("Savings Account"), but nothing else. Am I doing something
wrong? I've been banging my head against the wall on this one.

Thanks,
Aaron.
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list