MoneyWorks Manual
Curl_GetInfo (curlhandle, info)
Definition: After calling Curl_Exec, you can get information about the transfer using Curl_GetInfo. This is a convenient way to get the HTTP status of the transfer, particularly when Curl_Exec is returning the payload as its function result.
Currently supported information types are: CURLINFO_EFFECTIVE_METHOD
, CURLINFO_CONTENT_TYPE
, CURLINFO_PRIMARY_IP
, CURLINFO_EFFECTIVE_URL
, CURLINFO_PROXY_ERROR
, CURLINFO_OS_ERRNO
, CURLINFO_NUM_CONNECTS
, CURLINFO_SSL_VERIFYRESULT
, CURLINFO_REQUEST_SIZE
, CURLINFO_REDIRECT_COUNT
, CURLINFO_FILETIME
, CURLINFO_HTTP_CONNECTCODE
, CURLINFO_HEADER_SIZE
, CURLINFO_RESPONSE_CODE
, CURLINFO_APPCONNECT_TIME
, CURLINFO_PRETRANSFER_TIME
, CURLINFO_STARTTRANSFER_TIME
, CURLINFO_REDIRECT_TIME
, CURLINFO_NAMELOOKUP_TIME
, CURLINFO_SIZE_UPLOAD
, CURLINFO_SIZE_DOWNLOAD
, CURLINFO_SPEED_DOWNLOAD
, CURLINFO_SPEED_UPLOAD
, CURLINFO_TOTAL_TIME
.
You can also get the libcurl version with Curl_GetInfo(NULL, NULL)
Examples:
on Load let ch = Curl_Init(); curl_setopt(ch, CURLOPT_URL, "https://secure.cognito.co.nz/") let result = curl_exec(ch) // result will get the html content syslog("HTTP status = " + curl_getinfo(ch, CURLINFO_RESPONSE_CODE)) syslog("IP = " + curl_getinfo(ch, CURLINFO_PRIMARY_IP)) syslog("Eff URL = " + curl_getinfo(ch, CURLINFO_EFFECTIVE_URL)) syslog("pre xfer = " + curl_getinfo(ch, CURLINFO_PRETRANSFER_TIME)) syslog("size = " + curl_getinfo(ch, CURLINFO_SIZE_DOWNLOAD)) syslog("speed = " + curl_getinfo(ch, CURLINFO_SPEED_DOWNLOAD)) syslog("total time = " + curl_getinfo(ch, CURLINFO_TOTAL_TIME)) syslog("header size = " + curl_getinfo(ch, CURLINFO_HEADER_SIZE)) curl_close(ch) end
Availability: available within MWScript handlers in MoneyWorks 9 and later
See Also:
Base64Decode: String from a base64 encoding
Base64Encode: Base64 of a string
Curl_Close: Finish with a CURL session
Curl_Exec: Execute a CURL session
Curl_Init: Start a CURL session
Curl_StrError: Get an error message from a CURL object
URLEncode: Convert url unsafe characters in a string to "%xx”