How to make Perl Script "POST" call from another Perl Script???

Discussion in 'Perl' started by Wet Basement, Jul 15, 2003.

  1. Wet Basement

    Wet Basement Guest

    I am passing data to a putcart.pl , parsing it, then building the query
    string to put the item in the shopping cart:
    $cartStr =
    http://www.domain.com/cgi-bin/cart.pl?name=Book Title&Stk=D123456&price=5.00

    $co = new CGI;
    print $co->redirect($cartStr);
    print $co->start_html;
    $co->end_html;

    This works fine except that I need to pass book titles with "&" ( Bears &
    Cows ==> Bears+&+Cows ===> does NOT work) and &Stk needs to be "# D123456"
    (&Stk=#+D123456 ===> does NOT work) . It bombs when I try to pass "&" or
    "#" in the query string.

    1) Is there any way I can redirect or call a perl script from another perl
    script using "POST" so I do not have to deal with the & or # mess (or the +
    signs for spaces).

    2) If #1 is No, How do I pass "&" and "#" in a header query string. I
    could not make %26 work for & and found no % equivalent for #.

    Thanks so much.
    Lynn
     
    Wet Basement, Jul 15, 2003
    #1
    1. Advertising

  2. Wet Basement

    BobMonk Guest

    > I am passing data to a putcart.pl , parsing it, then building the query
    > string to put the item in the shopping cart:
    > $cartStr =
    >

    http://www.domain.com/cgi-bin/cart.pl?name=Book Title&Stk=D123456&price=5.00
    >
    > This works fine except that I need to pass book titles with "&" ( Bears &
    > Cows ==> Bears+&+Cows ===> does NOT work) and &Stk needs to be "# D123456"
    > (&Stk=#+D123456 ===> does NOT work) . It bombs when I try to pass "&" or
    > "#" in the query string.


    You might consider rethinking your approach to the problem. We save the
    users shopping cart information to a local database. Then we only need to
    pass the record number for the database entry as part of the calling string
    or insert it into a new form on the generated page. This allows state to
    travel with the page and prevents the possibility someone would edit the
    string to change the price. It also solves the problem of passing book
    titles as part of the string by saving the information elsewhere.

    If you want to stick with your current approach, use subsitutions for the
    characters you are trying to replace -- _AMP_ or _HASH_
    You can use a simple regex to put them into the string and a simple regex
    to put them in and pull them out.
     
    BobMonk, Jul 15, 2003
    #2
    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. Chason Hayes
    Replies:
    2
    Views:
    288
    M├ęta-MCI
    Mar 20, 2006
  2. Petterson Mikael

    Execute another perl script from my perl script

    Petterson Mikael, Jan 5, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    155
    Paul Lalli
    Jan 5, 2005
  3. Replies:
    20
    Views:
    888
    Gunnar Hjalmarsson
    Jan 18, 2005
  4. vikrant
    Replies:
    4
    Views:
    296
  5. PhEaSaNt PLuCKeR

    perl script to pass data to another perl script?

    PhEaSaNt PLuCKeR, Oct 30, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    175
Loading...

Share This Page