Добрый день!
Есть код curl запроса:
$ch = curl_init($host);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'Accept: application/json'));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($ch);
curl_close($ch);
Он выдает вот такой результат:
HTTP/1.1 200 OK Server: nginx Date: Mon, 20 Apr 2020 10:36:28 GMT Content-Type: application/json; charset=utf-8 Content-Length: 1691 Connection: keep-alive Cache-Control: private {"Model":{"ReasonCode":0,"PublicId":"pk_474a2da14ee45cb9a6834cbf9da55","TransactionId":337858838,"Amount":1,"Currency":"RUB","CurrencyCode":0,"PaymentAmount":1,"PaymentCurrency":"RUB","PaymentCurrencyCode":0,"InvoiceId":null,"AccountId":"ev.vasneva@gmail.com","Email":"ev.vasneva@gmail.com","Description":"Подписка на Город Фотографов","JsonData":"{\"course_id\":13,\"potok_number\":1,\"tarif\":0,\"number\":\"79313074592\",\"name\":\"Владимир\"}","CreatedDate":"\/Date(1585668931956)\/","PayoutDate":"\/Date(1586120400000)\/","PayoutDateIso":"2020-04-05T21:00:00","PayoutAmount":-2.9,"CreatedDateIso":"2020-03-31T15:35:31","AuthDate":"\/Date(1585668933061)\/","AuthDateIso":"2020-03-31T15:35:33","ConfirmDate":"\/Date(1586106605386)\/","ConfirmDateIso":"2020-04-05T17:10:05","AuthCode":"058813","TestMode":false,"Rrn":"221348325946","OriginalTransactionId":null,"IpAddress":"89.179.187.11","IpCountry":"RU","IpCity":"Москва","IpRegion":"Москва","IpDistrict":"Центральный федеральный округ","IpLatitude":55.755787,"IpLongitude":37.617634,"CardFirstSix":"547127","CardLastFour":"9200","CardExpDate":"11/22","CardType":"MasterCard","CardProduct":"TNW","CardCategory":"MASTERCARD NEW WORLD IMMEDIATE DEBIT ()","IssuerBankCountry":"RU","Issuer":"TINKOFF BANK","CardTypeCode":1,"Status":"Completed","StatusCode":3,"CultureName":"ru","Reason":"Approved","CardHolderMessage":"Оплата успешно проведена","Type":0,"Refunded":false,"Name":null,"Token":"619755374","SubscriptionId":null,"GatewayName":"Tinkoff","ApplePay":true,"AndroidPay":false,"TotalFee":0},"InnerResult":null,"Success":true,"Message":null}
Как убрать строчку «HTTP/1.1 200 O…» и т.п., чтобы я получал только json, без заголовков сервера?