Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Reaped: $20 For Coding Help

by NodeReaper (Curate)
on Aug 31, 2005 at 01:38 UTC ( #487996=perlquestion: print w/replies, xml ) Need Help??

NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: $20 For Coding Help
by tilly (Archbishop) on Aug 31, 2005 at 01:55 UTC
    If we know that you're trying to avoid paying the authors of the books that you want to download, why should we believe that you're going to pay whoever helps you?
Re: $20 For Coding Help
by gryphon (Abbot) on Aug 31, 2005 at 01:54 UTC

    Greetings copland,

    Its been a very long time since I've had to do anything with PHP, and I think I had a wee bit too much wine tonight with dinner; however, here's my first (untested) pass:

    use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $page = $ua->get( '' . '&user_id=<USERID>&xipn=<XPIN>&xhash=<XHASH>&trans_id=<TRANSID>' ); die "HTTP resquest not successful; $!" unless ($page->is_success); my $trans = split(',', (split("\n", $page->content)[-1]);

    If this works, keep your $20. I don't post here for money. (I do it for the XP... Just kidding.)

    gryphon Development Manager (DSMS)
    code('Perl') || die;

      I didn't know the links were pirated books, I was just typing stuff into Google for perl routines, and those links came up. Thanks for your help gryphon, I'll donate your $20 to perlmonks if it works. I'm going to check it out now!

        Heres a better suggestion for your $20- Perl & LWP copies from $17.43.

        Murray Barton
        Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho

      I've just tried it, and I'm getting 500 internal server errors. This is the original perl code I was using (the variables have been changed to *'s for security reasons):-
      #!/usr/bin/perl use LWP; &ReadParse; $timetoget = time; &GetDate; &AssignVariables; $paytox = &DoGet($urltopost); print "Content-type: text/html\n\n"; if ($paytox ne "") { print "AUTHORISED PAYMENT<br><br>"; print "Response recieved...<br><br>$paytox"; } else { print "DECLINED PAYMENT<br><br>"; print "No response..."; } exit; sub ReadParse { local (*in) = @_ if @_; local ($i, $key, $val); if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } else { $in = ( grep( !/^-/, @ARGV )) [0]; $in =~ s/\\&/&/g; } @in = split(/&/,$in); foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g; ($key, $val) = split(/=/,$in[$i],2); $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; $in{$key} .= "\0" if (defined($in{$key})); $in{$key} .= $val; } return length($in); } sub AssignVariables { $userid = "***"; $xpin = "****"; $xhash = "*****"; $transid = $in{'trans_id'}; $urltopost = "$ +userid&xipn=$xpin&xhash=$xhash&trans_id=$transid"; } sub DoPost { $browser = LWP::UserAgent->new( ) unless $browser; my $resp = $browser->post(@_); return ($resp->content, $resp->status_line, $resp->is_success, $resp +) if wantarray; return unless $resp->is_success; return $resp->content; } sub DoGet { $browser = LWP::UserAgent->new( ) unless $browser; my $resp = $browser->get(@_); return ($resp->content, $resp->status_line, $resp->is_success, $resp +) if wantarray; return unless $resp->is_success; return $resp->content; } sub GetDate { @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Frida +y','Saturday'); @months = ('jan','feb','mar','apr','may','jun','jul','aug','sep',' +oct','nov','dec'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +$timetoget); $year = $year+1900; $Date = "$days[$wday] $months[$mon]/$mday/$year"; }
Re: Reaped: $20 For Coding Help
by xorl (Deacon) on Aug 31, 2005 at 14:38 UTC
    This is probably blasphemy around here, but if you've got a PHP script provided by the 3rd party (paytox) you're trying to use, why don't you just use the PHP script? You shouldn't make life any harder than it already is. Plus these paytox people should provide some technical support for their scripts, or you shouldn't use them in the first place.

    Finally if you want to pay people to code, you should go somewhere else like expertsexchange, or similar place.

Re: $20 For Coding Help
by davidrw (Prior) on Aug 31, 2005 at 01:49 UTC
    if you want perl help, you have to post perl code .. you said you attempted LWP routines -- what are they? other than that, i think your php sample does the same as what's in the POD for LWP::Simple or WWW::Mechanize, so i'd recommend looking there.

    And please do not post links to pirated books...
Re: Reaped: $20 For Coding Help
by copland (Initiate) on Sep 01, 2005 at 06:52 UTC
    Thanks for all your help, you've been great. You really have. Words cannot begin to describe my gratitude. I love you all more than you can possibly imagine!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://487996]
Approved by tye
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2021-03-07 03:42 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (119 votes). Check out past polls.