Получение пустого сообщения в качестве ответа PHP CURL
Я пробовал print_r, httpcode равен 200, даже CURLOPT_VERBOSE не показывает ошибок. Тем не менее, он не возвращает никакого значения.
curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://dummy.com/xxx",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_VERBOSE=>true,
CURLOPT_TIMEOUT => 50,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => array(
"Authorization: Basic xxx",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "error:" . $err;
} else {
echo "response: ".$response;
}
Я получаю
response:
when I do CURLOPT_VERBOSE, this returned:
* Trying xxx.xx.xx.xxx...
* TCP_NODELAY set
* Connected to xxx.xx.xx.xxx (xxx.xx.xx.xxx) port xxxx (#0)
> POST /jw/web/json/plugin/org.joget.webservices.JsonRegistrationApiService/service HTTP/1.1
Host: xxx.xx.xxx.xxx
Accept: */*
Authorization: Basic Yxxxxxx
Content-Length: 775
Expect: 100-continue
Content-Type: application/json; boundary=------------------------916024cad4258a00
< HTTP/1.1 100
< HTTP/1.1 200
< Set-Cookie: JSESSIONID=4ED88EE9FD9746ED9C5F345F713FDB69; Path=/jw; HttpOnly
< X-Content-Type-Options: nosniff
< Content-Type: application/json;charset=utf-8
< Content-Length: 0
< Date: Tue, 16 Apr 2019 06:19:00 GMT
<
* Connection #0 to host xx.xx.xx.xxx left intact
Кто-нибудь хочет помочь php master?