Jump to content

Prestashop curl log in problem?


Recommended Posts

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

×
×
  • Create New...