libcurl's CURLINFO_RESPONSE_CODE and PHP's curl_getinfo() for FTP transfers
The actual constant name is CURLINFO_HTTP_CODE
(not CURLINFO_RESPONSE_CODE
, which is for libcurl
). Although there is HTTP in the name, you can get FTP response codes there as well:
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'ftp://user:pass@host.com');curl_exec($ch);$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);echo $response_code; // outputs 226, which means 'Closing data connection'