This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dictionary:more:loadurl [2018/09/01 16:41] James Sentman [Optional Parameters:] |
dictionary:more:loadurl [2019/08/26 10:42] (current) James Sentman added force http1 and reformatted a bit |
||
---|---|---|---|
Line 11: | Line 11: | ||
===Optional Parameters:=== | ===Optional Parameters:=== | ||
- | **timeout** (number: the number of seconds to wait before returning an error. Defaults to 30 seconds)\\ | + | * **timeout** (number: the number of seconds to wait before returning an error. Defaults to 30 seconds) |
- | **user** (text: if required for basic or digest authentication)\\ | + | * **user** (text: if required for basic or digest authentication) |
- | **password** (text: if required for basic or digest authentication)\\ | + | * **password** (text: if required for basic or digest authentication) |
- | **post data** (list: an applescript list of name=value pairs to be POSTED to the server. To send GET parameters include them in the url string as shown above. The list would look something like {“name=value”, “name2=value2”, “name2=value3”,...} )\\ | + | * **post data** (list: an applescript list of name=value pairs to be POSTED to the server. To send GET parameters include them in the url string as shown above. The list would look something like {“name=value”, “name2=value2”, “name2=value3”,...} ) |
- | **callback script** (text: the name of the global script to send the results to) If you leave this option out but include the handler name then the (thisScript) property will be used to try to call back into the same script that ran the loadURL command.\\ | + | * **callback script** (text: the name of the global script to send the results to) If you leave this option out but include the handler name then the (thisScript) property will be used to try to call back into the same script that ran the loadURL command. |
- | **callback handler** (text: the name of the handler in the global script handler to send the response, or error, to.)\\ | + | * **callback handler** (text: the name of the handler in the global script handler to send the response, or error, to.) |
- | **custom request** (text: a request type other than GET or POST) optional, if you need to send an HTTP request other than GET or PUT set the value here. If you need to send custom PUT or POST data that isn’t form encoded use the **put data** parameter below.\\ | + | * **custom request** (text: a request type other than GET or POST) optional, if you need to send an HTTP request other than GET or PUT set the value here. If you need to send custom PUT or POST data that isn’t form encoded use the **put data** parameter below. |
- | **follow redirects** (boolean: should the request be repeated if the server responds with a redirect) This defaults to true so by specifying “without follow redirects” you can stop it from trying to follow them.\\ | + | * **follow redirects** (boolean: should the request be repeated if the server responds with a redirect) This defaults to true so by specifying “without follow redirects” you can stop it from trying to follow them. |
- | **logging debug data** (boolean: logs all the communication and all the protocol negotiation data) Optional. Defaults to false, turn it on by adding “with logging debug data” to the command. Logs absolutely everything to the log. Good for debugging why something isn’t responding but not good to leave setup all the time.\\ | + | * **logging debug data** (boolean: logs all the communication and all the protocol negotiation data) Optional. Defaults to false, turn it on by adding “with logging debug data” to the command. Logs absolutely everything to the log. Good for debugging why something isn’t responding but not good to leave setup all the time. |
- | **put data** (text: optional) if included the post type will default to PUT and the block of data that you specify in this string will be sent to the server. If you change the request type via the custom request handler above then you can use this to send non-form encoded blocks of any data to the server. | + | * **put data** (text: optional) if included the post type will default to PUT and the block of data that you specify in this string will be sent to the server. If you change the request type via the custom request handler above then you can use this to send non-form encoded blocks of any data to the server. |
- | **extra headers** (list: optional) an applescript list of text items that will be added to the headers being sent. | + | * **extra headers** (list: optional) an applescript list of text items that will be added to the headers being sent. |
+ | * **force http1** (boolean: optional) add “with force http1” to force the connection to be made using the HTTP1.0 protocol. This can be useful if you are connecting to embedded devices that may not handle the Continue headers or chunked transfer which can be difficult for such things, or if you are talking to some older API’s that also do not support the same. | ||
===Callback Handler Info:=== | ===Callback Handler Info:=== | ||
Line 41: | Line 42: | ||
</code> | </code> | ||
===Examples:=== | ===Examples:=== | ||
- | **LoadURL** “https://www.apple.com/?these=are&get=parameters” **timeout** 120 **post data** {“name=value”, “name=value”} **callback script** “my global handler” **callback handler** “myCallback” | + | <code> |
+ | LoadURL “https://www.apple.com/?these=are&get=parameters” timeout 120 post data {“name=value”, “name=value”} callback handler “gotResult" | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | LoadURL “http://some.arduino.local/api/on” with force http1 | ||
+ | </code> | ||
===History=== | ===History=== | ||
Line 48: | Line 55: | ||
* **follow redirects** parameter was added in XTension v9.4 | * **follow redirects** parameter was added in XTension v9.4 | ||
* **logging debug data** parameter was added in XTension v9.4 | * **logging debug data** parameter was added in XTension v9.4 | ||
+ | * **force http1** parameter was added in v9.4.23 |