The company where I make an api call to changed there authentication to basic authentication. Here's there api documentation about this issue:
your partner code is "apiuser", secret key is "apipass".
Username is "apiuser". Password is "apipass". Basic auth string is Base64("apiuser:apipass") = "YXBpdXNlcjphcGlwYXNz=". Authentication header is "Authorization: Basic YXBpdXNlcjphcGlwYXNz=".
My current code is doing nothing so I don't know what i'm doing wrong?
$apiuser = "apiuser";
$apipass = "apipass";
$username = $apiuser.'-'.time();
$password = hash_hmac('sha1', $username, $apipass);
$basic_auth = base64_encode($username.":".$password);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept:application/json", "Authorization: Basic $basic_auth"));
curl_setopt($ch, CURLOPT_URL, 'http://examppleurl.com/api/v2/places?holiday_type='.$hotel_types_name.'¤cy=EUR&checkin='.date('Y-m-d', strtotime("+1 days")).'&checkout='.date('Y-m-d', strtotime("+1 days")).'&groups[]=1');//&groups[]=2,10,12&location=Turkey
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);