Use the following methods to add URL references to your Lua script.
Use these methods to transfer data over a secure HTTP connection.
Name |
Attribute/Arguments |
Comment |
---|---|---|
HttpClient.Download(table) |
(See 'table' Arguments) |
Specify a URL from which to download data. |
HttpClient.Upload(table) |
(See See 'table' Arguments) |
Specify a URL to which to upload data. |
HttpClient Table Entries |
||
---|---|---|
Name |
Type |
Description |
Url |
string |
The URL to either upload to or download from |
Headers |
table |
a table of header ( string --> string ) |
User |
string |
Username for authenticated sites |
Password |
string |
Password for authenticated sites |
Data |
string |
Used by .Upload |
Method |
string |
Either "POST" or "PUT", used by .Upload |
EventHandler |
function |
Function to call with status. Signature is function( table, code, data, error, headers). 'code' is the http return code (200 is good). |
Get a web page and show the return code, the page source, and any errors in the debug window.
function done(tbl, code, data, err, headers) print(string.format( "HTTP response from '%s': Return Code=%i; Error=%s", tbl.Url, code, err or "None" ) ) print("Headers:") for hName,Val in pairs(headers) do print(string.format( "\t%s = %s", hName, Val ) ) end print( "\rHTML Data: "..data ) end HttpClient.Download { Url = "http://www.google.com", EventHandler = done } |
Send Post data to a web site (Henry's HTTP Post Dumping Server). Note that this example uses the same EventHandler function as Example 1.
function done(tbl, code, d, e) print( code, d, e ) end
HttpClient.Upload { Url = "http://posttestserver.com/post.php", Method = "POST", User = "Admin", Password = "test", Data = "this is a test", Headers = { ["Content-Type"] = "text/html", Larry = "another larry" }, EventHandler = done } |
QSC.com | Software and Firmware | Resources | QSC Self Help Portal
© 2009 - 2018 QSC, LLC. All rights reserved. QSC and the QSC logo are trademarks of QSC, LLC in the U.S. Patent and Trademark office and other countries. All other trademarks are the property of their respective owners.
http://patents.qsc.com