Я пытаюсь подключиться к веб-службе с помощью PHP, и в журнале веб-службы я вижу сообщение: Credentials Basi c xxxxxxxxxxxxxxxx: rejected.
Однако, если я попытаюсь подключиться с те же учетные данные, на одном веб-сервисе с Postman, он работает, и возвращается результат. В Почтальоне в шапке у меня:
Ключ: Значение авторизации: Basi c xxxxxxxxxxxxxxxx
Вот мой PHP
$verb = "GET";
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $verb);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "Basic xxxxxxxxxxxxxxxx");
curl_setopt($ch, CURLOPT_URL, $webServiceUrl);
//curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_POSTFIELDS,urlencode($address)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
echo 'Curl error: ' . curl_error($ch) .'<hr>'; // This line prints Curl error:
curl_close ($ch);
$obj = json_decode($json);
var_dump($obj); // This line prints NULL
Может кто на на основе этого кода указывает мне, что я делаю не так?