CURL.ErrorCode
--------------

Returns the last CURL error code.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.ErrorCode"; curl ) 

**MBS**( **"CURL.ErrorCode";** /\* Returns the last CURL error code. \*/  
**$curl**) /\* The CURL session handle. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |

### Result

The last error code from CURL.

### Description

Returns the last CURL error code.  
  
Typical error codes are 6 for a wrong domain name in the URL, 67 for wrong name/password combination, 60 for missing SSL settings, 1 for an unsupported protocol.  
  
The list of possible error codes:  
  
| Name | Number | Description |
|---|---|---|
| CURLE\_OK | 0 | No error. |
| CURLE\_UNSUPPORTED\_PROTOCOL | 1 | Unsupported protocol. |
| CURLE\_FAILED\_INIT | 2 | Initialization failed or option not available. |
| CURLE\_URL\_MALFORMAT | 3 | URL has wrong format. |
| CURLE\_COULDNT\_RESOLVE\_PROXY | 5 | DNS didn't return proxy IP. |
| CURLE\_COULDNT\_RESOLVE\_HOST | 6 | DNS didn't return IP for host. |
| CURLE\_COULDNT\_CONNECT | 7 | Connection failed. |
| CURLE\_FTP\_WEIRD\_SERVER\_REPLY | 8 | FTP error. |
| CURLE\_REMOTE\_ACCESS\_DENIED | 9 | A service was denied by the server due to lack of access when login fails this is not returned. |
| CURLE\_FTP\_WEIRD\_PASS\_REPLY | 11 | FTP error. |
| CURLE\_FTP\_WEIRD\_PASV\_REPLY | 13 | FTP error. |
| CURLE\_FTP\_WEIRD\_227\_FORMAT | 14 | FTP error. |
| CURLE\_FTP\_CANT\_GET\_HOST | 15 | FTP error. |
| CURLE\_FTP\_COULDNT\_SET\_TYPE | 17 | FTP set command failed. |
| CURLE\_PARTIAL\_FILE | 18 | Only a part of the file was downloaded. |
| CURLE\_FTP\_COULDNT\_RETR\_FILE | 19 | File not found. |
| CURLE\_QUOTE\_ERROR | 21 | quote command failure |
| CURLE\_HTTP\_RETURNED\_ERROR | 22 | HTTP returned an error. |
| CURLE\_WRITE\_ERROR | 23 | Write error. |
| CURLE\_UPLOAD\_FAILED | 25 | failed upload "command" |
| CURLE\_READ\_ERROR | 26 | couldn't open/read from file |
| CURLE\_OUT\_OF\_MEMORY | 27 | Out Of memory |
| CURLE\_OPERATION\_TIMEDOUT | 28 | the timeout time was reached |
| CURLE\_FTP\_PORT\_FAILED | 30 | FTP PORT operation failed |
| CURLE\_FTP\_COULDNT\_USE\_REST | 31 | the REST command failed |
| CURLE\_RANGE\_ERROR | 33 | RANGE "command" didn't work |
| CURLE\_HTTP\_POST\_ERROR | 34 | HTTP Post failed. |
| CURLE\_SSL\_CONNECT\_ERROR | 35 | wrong when connecting with SSL |
| CURLE\_BAD\_DOWNLOAD\_RESUME | 36 | couldn't resume download |
| CURLE\_FILE\_COULDNT\_READ\_FILE | 37 | Failed to read file. |
| CURLE\_LDAP\_CANNOT\_BIND | 38 | LDAP can't connect. |
| CURLE\_LDAP\_SEARCH\_FAILED | 39 | LDAP Search failed. |
| CURLE\_FUNCTION\_NOT\_FOUND | 41 | Function not found. |
| CURLE\_ABORTED\_BY\_CALLBACK | 42 | Transfer aborted with [CURL.Cancel](CURLCancel.md). |
| CURLE\_BAD\_FUNCTION\_ARGUMENT | 43 | Bad parameters. |
| CURLE\_INTERFACE\_FAILED | 45 | CURL.OptionInterface failed |
| CURLE\_TOO\_MANY\_REDIRECTS | 47 | catch endless re-direct loops |
| CURLE\_UNKNOWN\_TELNET\_OPTION | 48 | User specified an unknown option |
| CURLE\_TELNET\_OPTION\_SYNTAX | 49 | Malformed telnet option |
| CURLE\_PEER\_FAILED\_VERIFICATION | 51 | peer's certificate or fingerprint wasn't verified fine |
| CURLE\_GOT\_NOTHING | 52 | when this is a specific error |
| CURLE\_SSL\_ENGINE\_NOTFOUND | 53 | SSL crypto engine not found |
| CURLE\_SSL\_ENGINE\_SETFAILED | 54 | can not set SSL crypto engine as default |
| CURLE\_SEND\_ERROR | 55 | failed sending network data |
| CURLE\_RECV\_ERROR | 56 | failure in receiving network data |
| CURLE\_SSL\_CERTPROBLEM | 58 | problem with the local certificate |
| CURLE\_SSL\_CIPHER | 59 | couldn't use specified cipher |
| CURLE\_SSL\_CACERT | 60 | problem with the CA cert (path?) |
| CURLE\_BAD\_CONTENT\_ENCODING | 61 | Unrecognized transfer encoding |
| CURLE\_LDAP\_INVALID\_URL | 62 | Invalid LDAP URL |
| CURLE\_FILESIZE\_EXCEEDED | 63 | Maximum file size exceeded |
| CURLE\_USE\_SSL\_FAILED | 64 | Requested FTP SSL level failed |
| CURLE\_SEND\_FAIL\_REWIND | 65 | Sending the data requires a rewind that failed |
| CURLE\_SSL\_ENGINE\_INITFAILED | 66 | failed to initialise ENGINE |
| CURLE\_LOGIN\_DENIED | 67 | user, password or similar was not accepted and we failed to login |
| CURLE\_TFTP\_NOTFOUND | 68 | file not found on server |
| CURLE\_TFTP\_PERM | 69 | permission problem on server |
| CURLE\_REMOTE\_DISK\_FULL | 70 | out of disk space on server |
| CURLE\_TFTP\_ILLEGAL | 71 | Illegal TFTP operation |
| CURLE\_TFTP\_UNKNOWNID | 72 | Unknown transfer ID |
| CURLE\_REMOTE\_FILE\_EXISTS | 73 | File already exists |
| CURLE\_TFTP\_NOSUCHUSER | 74 | No such user |
| CURLE\_CONV\_FAILED | 75 | conversion failed |
| CURLE\_CONV\_REQD | 76 | caller must register conversion callbacks |
| CURLE\_SSL\_CACERT\_BADFILE | 77 | could not load CACERT file, missing or wrong format |
| CURLE\_REMOTE\_FILE\_NOT\_FOUND | 78 | remote file not found |
| CURLE\_SSH | 79 | error from the SSH layer, somewhat generic so the error message will be of interest when this has happened |
| CURLE\_SSL\_SHUTDOWN\_FAILED | 80 | Failed to shut down the SSL connection |
| CURLE\_AGAIN | 81 | socket is not ready for send/recv, wait till it's ready and try again. |
| CURLE\_SSL\_CRL\_BADFILE | 82 | could not load CRL file, missing or wrong format. |
| CURLE\_SSL\_ISSUER\_ERROR | 83 | Issuer check failed. |
| CURLE\_FTP\_PRET\_FAILED | 84 | a PRET command failed |
| CURLE\_RTSP\_CSEQ\_ERROR | 85 | mismatch of RTSP CSeq numbers |
| CURLE\_RTSP\_SESSION\_ERROR | 86 | mismatch of RTSP Session Identifiers |
| CURLE\_FTP\_BAD\_FILE\_LIST | 87 | unable to parse FTP file list |
| CURLE\_CHUNK\_FAILED | 88 | chunk callback reported error |

### Examples

On success puts download in container, else shows failed:

 Set Variable \[$errorCode ; Value:MBS ("CURL.ErrorCode"; $curl )\]  
Set Variable \[$httpResult ; Value:MBS ("[CURL.GetResponseCode](CURLGetResponseCode.md)"; $curl )\]  
Set Field \[Download Async::Result ; $errorCode \]  
Set Field \[Download Async::DebugMessages ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
If \[$errorCode = 0 and $httpResult = 200\]  
 Set Field \[Download Async::Progress ; "Done"\]  
 Set Field \[Download Async::Output ; MBS ("[CURL.GetResultAsContainer](CURLGetResultAsContainer.md)"; $curl )\]  
Else  
 Set Field \[Download Async::Progress ; "Failed"\]  
 Set Field \[Download Async::Output ; ""\]  
End If  
### See also

- [CURL.Cancel](CURLCancel.md)
- [CURL.GetDebugMessages](CURLGetDebugMessages.md)
- [CURL.GetResponseCode](CURLGetResponseCode.md)
- [CURL.GetResultAsContainer](CURLGetResultAsContainer.md)
- [CURL.IsRunning](CURLIsRunning.md)
- [CURL.ReceiveData](CURLReceiveData.md)
- [CURL.ReceiveText](CURLReceiveText.md)
- [CURL.SendData](CURLSendData.md)
- [CURL.SendText](CURLSendText.md)
- [CURL.SetOptionConnectOnly](CURLSetOptionConnectOnly.md)

### Example Databases

- [CURL/Batch Download](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Batch%20Download.shtml#8ScriptAnchor_)
- [CURL/CURL and OnWindowTransaction](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20and%20OnWindowTransaction.shtml#2ScriptAnchor_)
- [CURL/CURL Certificate Pinning](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Certificate%20Pinning.shtml#1ScriptAnchor_)
- [CURL/CURL Low Level Sockets](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Low%20Level%20Sockets.shtml#2ScriptAnchor_)
- [CURL/Download Async](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Download%20Async.shtml#3ScriptAnchor_)
- [CURL/Email/Batch Emailer](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Batch%20Emailer.shtml#8ScriptAnchor_)

### Blog Entries

- [Parallel network transfers with MBS Plugin](https://www.mbsplugins.de/archive/2023-12-18/Parallel_network_transfers_wit/monkeybreadsoftware_blog_filemaker)
- [Send Audit Log via CURL in background](https://www.mbsplugins.de/archive/2023-11-30/Send_Audit_Log_via_CURL_in_bac/monkeybreadsoftware_blog_filemaker)
- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)
- [Batch sending Emails in FileMaker via MBS Plugin](https://www.mbsplugins.de/archive/2017-01-10/Batch_sending_Emails_in_FileMa/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2024, Seite 18](https://filemaker-magazin.de/neuigkeit/4257-Appetithappen-FMM_202402)

This function checks for a license.

Created 18th August 2014 , last changed 3th January 2023

  
[CURL.CreateOutputFile](CURLCreateOutputFile.md) - [CURL.ErrorMessage](CURLErrorMessage.md)

[HTML Version](CURLErrorCode.shtml)