Luke_Massoud Posted March 26, 2009 Share Posted March 26, 2009 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¤t_loc=/details/2153603.html&_action=add&prd_id=2232162"); echo curl_exec ($ch); curl_close ($ch); ?> Thank you for your help Link to comment https://forums.phpfreaks.com/topic/151154-6-lines-of-curl-for-simple-add-to-cart-button-not-work-please-help-me-mates/ Share on other sites More sharing options...
Luke_Massoud Posted March 26, 2009 Author Share Posted March 26, 2009 anything ? Link to comment https://forums.phpfreaks.com/topic/151154-6-lines-of-curl-for-simple-add-to-cart-button-not-work-please-help-me-mates/#findComment-794804 Share on other sites More sharing options...
chmpdog Posted March 27, 2009 Share Posted March 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/151154-6-lines-of-curl-for-simple-add-to-cart-button-not-work-please-help-me-mates/#findComment-794840 Share on other sites More sharing options...
Luke_Massoud Posted March 27, 2009 Author Share Posted March 27, 2009 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. Link to comment https://forums.phpfreaks.com/topic/151154-6-lines-of-curl-for-simple-add-to-cart-button-not-work-please-help-me-mates/#findComment-795002 Share on other sites More sharing options...
tdldp Posted March 27, 2009 Share Posted March 27, 2009 curl_setopt($ch, CURLOPT_POSTFIELDS,"product_inputs[details]=fat¤t_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 Link to comment https://forums.phpfreaks.com/topic/151154-6-lines-of-curl-for-simple-add-to-cart-button-not-work-please-help-me-mates/#findComment-795023 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.