integration_with_other_systems
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
integration_with_other_systems [2024/04/04 10:14] – [HTTP / HTTPS requests] emozolyak | integration_with_other_systems [2024/04/04 10:18] (current) – [Troubleshooting CURL requests from WebHMI] emozolyak | ||
---|---|---|---|
Line 124: | Line 124: | ||
Please note that HTTPS requests are only possible in **WebHMI Pro** version and virtualization images. | Please note that HTTPS requests are only possible in **WebHMI Pro** version and virtualization images. | ||
</ | </ | ||
+ | |||
+ | ==== Troubleshooting CURL requests from WebHMI ==== | ||
+ | |||
+ | When troubleshooting your requests, you can turn on verbose information in your script. Please refer to the example below: | ||
+ | |||
+ | <code lua> | ||
+ | function main (userId) | ||
+ | local res = "" | ||
+ | local c = cURL.easy_init() | ||
+ | c : setopt{ url = ' | ||
+ | timeout = 30, | ||
+ | httpheader = {' | ||
+ | ' | ||
+ | -- 'Host: < | ||
+ | } | ||
+ | } | ||
+ | |||
+ | -- sw on verbose info | ||
+ | c : setopt{[cURL.OPT_VERBOSE] = 1} | ||
+ | c : setopt{[cURL.OPT_DEBUGFUNCTION] = function(...) | ||
+ | for i, v in pairs(arg) do DEBUG(i .. ' ' .. v) end | ||
+ | return 0 | ||
+ | end } | ||
+ | |||
+ | c : perform{writefunction = function(str) | ||
+ | res = res .. str | ||
+ | end} | ||
+ | c : close() | ||
+ | |||
+ | INFO(res) | ||
+ | if (res == '' | ||
+ | ERROR(' | ||
+ | else | ||
+ | INFO(' | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | |||
integration_with_other_systems.1712225653.txt.gz · Last modified: 2024/04/04 10:14 by emozolyak