The PHP Function Curl_Errno
The php function curl_errno is used to get the last error message of a cURL session. It is usually useful when you are trying to download or upload files from and to a server. This article will help you learn about this function and understand how it works.
This is an excellent example of a function that doesn’t work like it should, and which demonstrates one of the biggest problems with PHP: that very few people designing, working on, or writing code in it seem to have any clue what they’re doing. cURL, and the other modules that use it, have their own ways of doing things, which often don’t fit with what you expect in a general-purpose language.
For example, there are functions for detecting what kind of platform you’re running on (e.g. pcntl, php_uname), but no way to get that information without using a function whose behavior is prone to change in future versions. There are also a lot of weird things that happen because of the fact that objects don’t behave like objects in PHP, even when you use metaprogramming to treat them like objects. For example, there are a bunch of functions that return string values, but you can’t do a typeof(str) to see what they are.
cURL has a lot of different errors that you can get from it, and the php function curl_errno helps you to understand those errors. For instance, CURLE_FTP_BAD_DOWNLOAD_RESUME (36)-Cannot resume a download because the file has exceeded the maximum transfer size. There are other ones too, such as CURLE_TOO_MANY_REDIRECTS (47)-During redirection, the number of calls to libcurl's internal redirect functions exceeds a limit set by the user through the CURLOPT_MAX option.