Libcurl CURLINFO_RESPONSE_CODE and PHP curl_getinfo () for FTP transfers

Is it possible to assume that the value of PHP curl_getinfo() returns for the array key 'http_code' - the value of libcurl CURLINFO_RESPONSE_CODE?

In other words: CURLINFO_HTTP_CODE value using curl_getinfo() in PHP match the CURLINFO_RESPONSE_CODE value with curl_easy_getinfo() in libcurl?

And why does it also make sense for FTP transfers?

And the value after the FTP transfer is the FTP response code ?

+4
source share
1 answer

The actual name of the constant is CURLINFO_HTTP_CODE (not CURLINFO_RESPONSE_CODE , which is for libcurl ). Although the title contains HTTP, you can also get FTP response codes:

 $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' 
+2
source

All Articles