Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I use this to send txt messages to my cell when my Paypal balance changes.
#!/usr/bin/perl # silent11 # 11/16/2004 use strict; use warnings; my $paypal_email = ""; my $paypal_pass = ""; my $notify_from = ""; my $notify_to = ""; my $balance_file = "balance.txt"; my $balance = return_balance(); # # # Get notified via email (or cell phone txt msg) # # # of Paypal balance changes notify_me( $balance ) if compare( $balance ); # # # Subs # # # sub return_balance { use WWW::Mechanize; my $browser = WWW::Mechanize->new(); $browser->get(""); $browser->form(1); $browser->field("login_email", $paypal_email); $browser->field("login_password", $paypal_pass); $browser->click(); $browser->follow("click here to reload"); my $html = $browser->content; # Please don't laugh at the regex ;^) It works! $html =~ /(.*history">\$)(\d+\.\d+) (USD)/s; return $2; } sub compare { use Tie::File; # First time to use Tie::File # very cool! tie my @balance, 'Tie::File', $balance_file || die $!; my $new_balance = shift; my $cur_balance = $balance[0]; $balance[0] = $new_balance; untie @balance; return 1 if ($new_balance != $cur_balance); } sub notify_me { use MIME::Lite; my $msg = MIME::Lite->new( From => $notify_from, To => $notify_to, Subject => 'Paypal Balance', Data => $balance ); $msg->send || die $!; }

Update: changed http to https per zentra's suggestion.

Spread Firefox

In reply to Get notified of Paypal balance changes by silent11

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (2)
    As of 2018-08-17 01:12 GMT
    Find Nodes?
      Voting Booth?
      Asked to put a square peg in a round hole, I would:

      Results (174 votes). Check out past polls.