Как передать результат выполнения PHP метода на конкретный адрес
Первый раз реализую API и провожу интеграцию с другим сервисом.
Суть такая:
1) Мой метод принимает JSON документ в котором есть такое поле как callback_url
2) Обрабатываю данные и генерирую ответ в JSON
3) Отправляю ответ на callback_url
На текущий момент данные я получаю, обрабатываю, формирую запрос и по cURL отправляю на callback_url, но он туда не доходит.
Подскажите, куда мне копать.
Код отправки ответа:
public function sendStatus($url, $status, $code){
// http_response_code($code);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $status);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $response;
лог отправки такой
* Trying 217.172.26.37...
* TCP_NODELAY set
* Connected to test.url (217.172.26.37) port 80 (#0)
> POST /api/test.php HTTP/1.1
Host: test.url
Accept: */*
Content-Type: application/json
Content-Length: 47
* upload completely sent off: 47 out of 47 bytes
< HTTP/1.1 200 OK
< Server: nginx-reuseport/1.13.4
< Date: Wed, 18 Mar 2020 11:23:46 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 176
< Connection: keep-alive
< Keep-Alive: timeout=30
< Vary: Accept-Encoding
< X-Powered-By: PHP/5.6.40
< Vary: Accept-Encoding
<
* Curl_http_done: called premature == 0
* Connection #0 to host test.url left intact