I try to implement a simple mobile.de request following the instructions in the mobile.de documentation.
My code is:
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$uspw = base64_encode($username . ':' . $password);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://services.mobile.de/1.0.0
/ad/search?exteriorColor=BLACK');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . $uspw, 'Accept:
application/xml'));
//curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_exec($ch);
curl_close($ch);
?>
But everytime I try to run this skript I get error 401 "This request requires HTTP authentication ()."
I found several posts with identical problems and tried every suggestions from their answers but nothing works for me. So I would be really greatful for every suggestions and tips.
Best wishes!