Jump to content

6 lines of cURL for simple Add to cart button = NOT WORK (please help me mates)


Luke_Massoud

Recommended Posts

Hi there ,

All day I have been stumped with this problem.

Ive tried cURL and other stuff but nothing works.

I just get a blank page. Anyway I am desperate now.

My eyes are bloodshot , I just want to go to bed.

I would be very greatfull for your help .

Please see this page:

http://swathe.cart.net.au/details/2153603.html

I want to simulate the clicking of that "Add to Basket" button.

Could you please help me make a simple script (doesn't have to be using cURL) to do this ?

I know its easy.

 

Here is my(broken) script:

 

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://swathe.cart.net.au/action_handler.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"product_inputs[details]=fat&current_loc=/details/2153603.html&_action=add&prd_id=2232162");
echo curl_exec ($ch);
curl_close ($ch); 
?>

 

 

Thank you for your help  :-*

 

 

I would recommend using a php script to do this, partially because I dont know cURL, and partially because there are plenty of great, free php "add to basket" scripts.

 

heres one I found: http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart

 

well thank you for your post!

but actually I am not trying to create a shopping cart.

Just trying to send a HTTP POST to a php a that page so it behaves as if I had clicked on the add to cart button on that page I mentioned in my post.

 

curl_setopt($ch, CURLOPT_POSTFIELDS,"product_inputs[details]=fat&current_loc=/details/2153603.html&_action=add&prd_id=2232162");

 

i think it has to do with your slashes.."/"

it can also come from the action "_" that is not received on the target php page...

 

What misses here, is mainly your php receipt page... to know how you process data you have curled...

 

Tdldp

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.