Jump to content

Prestashop curl log in problem?


Recommended Posts

I'm trying to log-in as customer using cUrl method in Prestashop.


When I send my cUrl request, my values are inserted in the log-in form but the form is not submitted. Same curl method i used for registration and registration is done but login 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...