nomi90 Posted August 6, 2014 Share Posted August 6, 2014 I trying to log as customer using cUrl method in prestashop. When i send cUrl request my values are inserted in login form but form is not submitted. Here my code : $url = 'http://example.com/prestashop/login'; $fields = array( 'submitLogin' => 1, 'email' => '[email protected]', 'passwd' => '123456', ); $fields_string = ''; foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); $result = curl_exec($ch); //print 'yes123';die; $response = json_decode($result); print_r($response); curl_close($ch); Link to comment Share on other sites More sharing options...
Recommended Posts