How can I know when I use php to show the status of the opposite server 502404500?

the counterparty uses the nginx ubuntu server

I use curl to communicate with him
I would like to say how to make a php interview
after entering this interview, I can find out the current server status of the counterparty
but how can I write this code if the counterparty gives me a reply of 502 or other errors
?

call his primary domain name with curl?
or is there any other way?

Mar.04,2021

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

for more details, please see http://php.net/manual/zh/func.

.
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-1e3f606-44825.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-1e3f606-44825.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?