How does php CURL get 500 errors returned by the opposite party?

clipboard.png

I am using curl to ask
when the error is 500, for example,
how can I catch the information he spits out here with me?
because if there are no errors, the counterpart can send me a reply to json and receive it, it can show
, but it will send back 500 errors when the counterpart goes wrong, so how can I catch this piece of text?
I"ve been doing this for a long time, but I still haven"t caught

.
$ch = curl_init($api);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  $result = curl_exec($ch);
Mar.03,2021

the

that can be obtained in the header information

// 
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

// 
$header = substr($result, 0, $headerSize);

$httpCode = curl_getinfo ($ch, CURLINFO_HTTP_CODE);

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdcb4d-3130a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdcb4d-3130a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?