form post URL encoded

Discussion in 'Perl Misc' started by Hristo Panayotov, Jun 26, 2013.

  1. Hi folks ! Just registered. I need to send to a Payment Gateway encrypted XML /base64/. Here are their requirements :
    =====================
    2.Parameter encryption
    Java
    /String base64Xml = URLEncoder.encode(xml.toString(),"UTF-8");
    sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
    String base64 = encoder.encode(base64Xml.getBytes());
    Php:
    $base64 =base64_encode(urlencode($baseStr));
    3.Data Submit
    <form action=“https://payment.server.com/payment/Interface” method=“post”>
    <input type=”hidden” name=”TradeInfo” value=”<%= base64 %>”/>
    <input type=”submit” value=”submit” />
    </form>
    ===================
    I do everything to complete my XML then I encode it base64 and try to send.They said that cannot decode it. Why? - they dont know. Me too as I'm newby in Perl. They said that maybe my string is not correctly URL encoded...Here is the part of my sending :

    #======= Encode XML base64 ================================
    use MIME::Base64 ;
    $enco = encode_base64($wr);

    #======= Send request to Payment Gateway ==================
    use HTTP::Request::Common qw(POST);
    use LWP::UserAgent;
    $ua = LWP::UserAgent->new();
    my $req = POST 'https://payment.server.com/payment/Interface'; [
    type=>'hidden',
    name=> 'TradeInfo',
    value=> $enco,
    type=>'submit',
    value=>'submit',

    ];


    $content = $ua->request($req)->as_string;
    # print "Content-type: text/html\n\n";
    print $content;
    ======================
    $enco is encoded string. When I sent them $enco in a file they decode it correctly. But when I send through Post method they cant

    I receive a error.jsp?error=1001 all the time I send
    Mybe something wrong in my post? Or ?....
    Any help ??????????????????????????????????
    Hristo Panayotov, Jun 26, 2013
    #1
    1. Advertising

  2. Hristo Panayotov <> writes:
    > =====================
    > 2.Parameter encryption
    > Java
    > /String base64Xml = URLEncoder.encode(xml.toString(),"UTF-8");
    > sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
    > String base64 = encoder.encode(base64Xml.getBytes());
    > Php:
    > $base64 =base64_encode(urlencode($baseStr));
    > 3.Data Submit
    > <form action=“https://payment.server.com/payment/Interface†method=“postâ€>
    > <input type=â€hidden†name=â€TradeInfo†value=â€<%= base64 %>â€/>
    > <input type=â€submit†value=â€submit†/>
    > </form>
    > ===================
    > I do everything to complete my XML then I encode it base64 and try to send. They said that cannot decode it. Why? - they dont know. Me too as I'm newby in Perl. They said that maybe my string is not correctly URL encoded...Here is the part of my sending :
    >
    > #======= Encode XML base64 ================================
    > use MIME::Base64 ;
    > $enco = encode_base64($wr);
    >
    > #======= Send request to Payment Gateway ==================
    > use HTTP::Request::Common qw(POST);
    > use LWP::UserAgent;
    > $ua = LWP::UserAgent->new();
    > my $req = POST 'https://payment.server.com/payment/Interface'; [
    > type=>'hidden',
    > name=> 'TradeInfo',
    > value=> $enco,
    > type=>'submit',
    > value=>'submit',
    >
    > ];
    >
    >
    > $content = $ua->request($req)->as_string;
    > # print "Content-type: text/html\n\n";
    > print $content;
    > ======================
    > $enco is encoded string. When I sent them $enco in a file they
    > decode it correctly. But when I send through Post method they cant


    Quick guess: Are you posting the text with correct line endings, that
    is \xd\xa after each line? (you should probably also do somethin a la
    binmode(STDOUT) to stop perl from messing with the data).
    Rainer Weikusat, Jun 26, 2013
    #2
    1. Advertising

  3. ThanQ Ben ! It is one of my first Perl tries ;) Could U help me some ? itko59 at gmail dot com
    Hristo Panayotov, Jun 26, 2013
    #3
  4. ThanQ very much ! I'll have in mind ur suggestion. Have to learn !
    ThanQ again !
    Hristo Panayotov, Jun 26, 2013
    #4
  5. And thanks again ! It has worked ;)
    Hristo Panayotov, Jun 26, 2013
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Amada

    URL Decode HTML encoded in JavaScript

    Ben Amada, Sep 30, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    17,864
    Ben Amada
    Sep 30, 2005
  2. Fredrik Kronander

    Encoded chars from form post

    Fredrik Kronander, Feb 3, 2005, in forum: ASP General
    Replies:
    3
    Views:
    170
    Fredrik Kronander
    Feb 3, 2005
  3. Randy Lawrence
    Replies:
    0
    Views:
    281
    Randy Lawrence
    Jul 4, 2004
  4. Randy Lawrence
    Replies:
    2
    Views:
    245
    Randy Lawrence
    Jul 4, 2004
  5. Replies:
    1
    Views:
    125
Loading...

Share This Page