22.12.2013 Views

Roku Object Reference - imaginArt

Roku Object Reference - imaginArt

Roku Object Reference - imaginArt

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

oUrlTransfer ()<br />

This object is used for reading from and writing to remote servers through URLs.<br />

This object is created with no parameters:<br />

• Create<strong>Object</strong>("roUrlTransfer")<br />

The interface provides:<br />

• GetIdentity() As Integer<br />

o Returns a magic number that can be used to identify whether events originated from this<br />

object.<br />

• SetUrl(URL As String) As Boolean<br />

o Sets the URL to use for the transfer request.<br />

o Returns false on failure – use GetFailureReason() to find out the reason for the failure.<br />

• SetPort(port As ifMessagePort) As Void<br />

o Set the message port to which events will be posted for asynchronous requests.<br />

• AddHeader(name As String, value As String) As Boolean<br />

o Add the specified HTTP header. Only valid for HTTP URLs.<br />

o Returns false on failure – use GetFailureReason() to find out the reason for the failure.<br />

• GetToString() As String<br />

o Connect to the remote service as specified in the URL and return the response body as a<br />

string. This function cannot return until the exchange is complete and it may block for a long<br />

time.<br />

o Only having a single string return means that much of the information (headers, response<br />

codes) is discarded. If this information is required then use AsyncGetToString instead.<br />

o The size of string returned is limited to 65536 characters.<br />

• GetToFile(filename As String) As Integer<br />

o Connect to the remote service as specified in the URL and write the response body to the<br />

specified file.<br />

o This function does not return until the exchange is complete and may block for a long time.<br />

o The response code from the server is returned. It is not possible to access any of the response<br />

headers. If this information is required use AsyncGetToFile instead.<br />

• AsyncGetToString() As Boolean<br />

o Begin a get request to a string asynchronously. Events will be sent to the message port<br />

associated with the object. If false is returned then the request could not be issued and no<br />

events will be delivered.<br />

• AsyncGetToFile(filename As String) As Boolean<br />

o Begin a get request to a file asynchronously. Events will be sent to the message port<br />

associated with the object. If false is returned then the request could not be issued and no<br />

events will be delivered.<br />

• Head() As roUrlEvent<br />

o Synchronously perform an HTTP HEAD request and return the resulting response code and<br />

headers through a roUrlEvent object. In the event of catastrophic failure (e.g. an asynchronous<br />

operation is already active) then a null object is returned.<br />

• AsyncHead() As Boolean<br />

o Begin an HTTP HEAD request asynchronously. Events will be sent to the message port<br />

associated with the object. If false is returned then the request could not be issued and no<br />

events will be delivered.<br />

• PostFromString(request As String) As Integer<br />

o Use the HTTP POST method to post the supplied string to the current URL and return the<br />

response code. Any response body is discarded.<br />

• PostFromFile(filename As String) As Boolean<br />

o Use the HTTP POST method to post the contents of the file specified to the current URL and<br />

return the response code. Any response body is discarded.<br />

49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!