CURL类库返回说明
curl_easy_perform()返回值说明
response=curl_easy_perform(curl);
response返回的状态值
CURLE_OK: printf("send ok!"n");
CURLE_HTTP_POST_ERROR: printf("post error!"n");
CURLE_COULDNT_CONNECT: printf("cannot connect to server"n");
CURLE_OK = 0, /* 0 */ 0: no error
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ 1: unsupported protocol
CURLE_FAILED_INIT, /* 2 */ 2: failed init
CURLE_URL_MALFORMAT, /* 3 */ 3: URL using bad/illegal format or missing URL
CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ 4: unknown error
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ 5: couldn't resolve proxy name
CURLE_COULDNT_RESOLVE_HOST, /* 6 */ 6: couldn't resolve host name
CURLE_COULDNT_CONNECT, /* 7 */ 7: couldn't connect to server
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ 8: FTP: weird server reply
CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server 9: FTP: access denied
due to lack of access - when login fails
this is not returned. */
CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 - NOT USED */ 10: unknown error
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ 11: FTP: unknown PASS reply
CURLE_FTP_WEIRD_USER_REPLY, /* 12 */ 12: FTP: unknown USER reply
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ 13: FTP: unknown PASV reply
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ 14: FTP: unknown 227 response format
CURLE_FTP_CANT_GET_HOST, /* 15 */ 15: FTP: can't figure out the host in the PASV response
CURLE_FTP_CANT_RECONNECT, /* 16 */ 16: FTP: can't connect to server the response code is unknown
CURLE_FTP_COULDNT_SET_BINARY, /* 17 */ 17: FTP: couldn't set binary mode
CURLE_PARTIAL_FILE, /* 18 */ 18: Transferred a partial file
CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ 19: FTP: couldn't retrieve (RETR failed) the specified file
CURLE_FTP_WRITE_ERROR, /* 20 */ 20: FTP: the post-transfer acknowledge response was not OK
CURLE_FTP_QUOTE_ERROR, /* 21 */ 21: FTP: a quote command returned error
CURLE_HTTP_RETURNED_ERROR, /* 22 */ 22: HTTP response code said error
CURLE_WRITE_ERROR, /* 23 */ 23: failed writing received data to disk/application
CURLE_MALFORMAT_USER, /* 24 - NOT USED */ 24: unknown error
CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ 25: upload failed (at start/before it took off)
CURLE_READ_ERROR, /* 26 - could open/read from file */ 26: failed to open/read local data from file/application
CURLE_OUT_OF_MEMORY, /* 27 */ 27: out of memory
/* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
instead of a memory allocation error if CURL_DOES_CONVERSIONS
is defined
*/
CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */ 28: a timeout was reached
CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */ 29: FTP could not set ASCII mode (TYPE A)
CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ 30: FTP command PORT failed
CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ 31: FTP command REST failed
CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */ 32: FTP command SIZE failed
CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ 33: a range was requested but the server did not deliver it
CURLE_HTTP_POST_ERROR, /* 34 */ 34: internal problem setting up the POST
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ 35: SSL connect error
CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ 36: couldn't resume download
CURLE_FILE_COULDNT_READ_FILE, /* 37 */ 37: couldn't read a file:// file
CURLE_LDAP_CANNOT_BIND, /* 38 */ 38: LDAP: cannot bind
CURLE_LDAP_SEARCH_FAILED, /* 39 */ 39: LDAP: search failed
CURLE_LIBRARY_NOT_FOUND, /* 40 */ 40: a required shared library was not found
CURLE_FUNCTION_NOT_FOUND, /* 41 */ 41: a required function in the shared library was not found
CURLE_ABORTED_BY_CALLBACK, /* 42 */ 42: the operation was aborted by an application callback
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ 43: a libcurl function was given a bad argument
CURLE_BAD_CALLING_ORDER, /* 44 - NOT USED */ 44: unknown error
CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ 45: failed binding local connection end
CURLE_BAD_PASSWORD_ENTERED, /* 46 - NOT USED */ 46: unknown error
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ 47: number of redirects hit maximum amount
CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ 48: User specified an unknown option
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ 49: Malformed telnet option
CURLE_OBSOLETE, /* 50 - NOT USED */ 50: unknown error
CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */ 51: SSL peer certificate was not ok
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ 52: server returned nothing (no headers, no data)
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ 53: SSL crypto engine not found
CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as 54: can not set SSL crypto engine as default
default */
CURLE_SEND_ERROR, /* 55 - failed sending network data */ 55: failed sending data to the peer
CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ 56: failure when receiving data from the peer
CURLE_SHARE_IN_USE, /* 57 - share is in use */ 57: share is already in use
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ 58: problem with the local SSL certificate
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ 59: couldn't use specified SSL cipher
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ 60: peer certificate cannot be authenticated with known CA certificates
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ 61: Unrecognized HTTP Content-Encoding
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ 62: Invalid LDAP URL
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ 63: Maximum file size exceeded
CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ 64: Requested FTP SSL level failed
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind 65: Send failed since rewinding of the data stream failed
that failed */
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ 66: failed to initialise SSL crypto engine
CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not 67: FTP: login denied
accepted and we failed to login */
CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ 68: TFTP: File Not Found
CURLE_TFTP_PERM, /* 69 - permission problem on server */ 69: TFTP: Access Violation
CURLE_TFTP_DISKFULL, /* 70 - out of disk space on server */ 70: TFTP: Disk full or allocation exceeded
CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ 71: TFTP: Illegal operation
CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ 72: TFTP: Unknown transfer ID
CURLE_TFTP_EXISTS, /* 73 - File already exists */ 73: TFTP: File already exists
CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ 74: TFTP: No such user
CURLE_CONV_FAILED, /* 75 - conversion failed */ 75: conversion failed
CURLE_CONV_REQD, /* 76 - caller must register conversion 76: caller must register CURLOPT_CONV_ callback options
callbacks using curl_easy_setopt options
CURLOPT_CONV_FROM_NETWORK_FUNCTION,
CURLOPT_CONV_TO_NETWORK_FUNCTION, and
CURLOPT_CONV_FROM_UTF8_FUNCTION */
CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing 77: problem with the SSL CA cert (path? access rights?)
or wrong format */
CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ 78: Remote file not found
CURLE_SSH, /* 79 - error from the SSH layer, somewhat 79: Error in the SSH layer
generic so the error message will be of
interest when this has happened */
CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL 80: Failed to shut down the SSL connection
connection */