CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Need help with POST

 



aakash
New User

Oct 4, 2008, 4:39 PM

Post #1 of 3 (794 views)
Need help with POST Can't Post

I am trying to write a perl script that will select a product to shop from a website, enter quantity, add to cart and checkout. I have been able to select the product but i am not able to submit the 'add to cart'. The 'add to cart' is an image instead of a button. I am using POST but it is not working. Here is part of the code i am using:

my $url = "http://www.xyz.com/shop/index.php?main_page=products&cPath=2&prod_no=1;
my $browser = LWP::UserAgent->new;
resp = $browser->post($url,
['Cart_Qty' => 'form.submit()']);

Section of the HTML code:
<form name="Cart_Qty" action="http://www.xyz.com/shop/index.php?main_page=products&amp;cPath=2&amp;prod_no=1&amp;action=add_product" method="post" enctype="multipart/form-data">

<div id="cartAdd">
Add to Cart: <input type="text" name="Cart_Qty" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="prod_no" value="8" /><input type="image" src="includes/templates/template_default/buttons/english/button_in_cart.gif" alt="Add to Cart" title=" Add to Cart " /> </div>

Appreciate any help with this. Thanks!


sycoogtit
User

Oct 6, 2008, 5:56 AM

Post #2 of 3 (745 views)
Re: [aakash] Need help with POST [In reply to] Can't Post

That sounds like a scary script. Why are you doing that?

Without putting this into emacs and trying to debug it myself, the only thing that jumps out at me is you have two HTML elements named Cart_Qty. That could cause problems.

--
http://bunsooter.com


KevinR
Veteran


Oct 6, 2008, 9:45 AM

Post #3 of 3 (742 views)
Re: [sycoogtit] Need help with POST [In reply to] Can't Post

mixing POST and GET data and javascript to boot? Yikes.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives