I am trying to update a page with image products of a Prestashop instance.
I am getting the information using prestashop web services.
The problem is when I load the page , it asks me the Token/key of the prestashop but I would want to save the login session using the Url and the key which I pass from by CURL and not entering the key each time.
However the output of curl_exec
is some strange characters like ��#B��R��$3br�
Here is the function to save the session:
function saveSession($url, $key){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $key.':');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate,sdch');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
I don't know if the problem is with the encoding, header or is there any other solution!?