babuhari123
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2012
11:24 PM
how use GET/Post method in RoUrlTranfer
Hi Friend,
My problem is while creating RoUrlTranfer
i need to post one xml string along with querystring with the method POST and get responce string
How to set Post method in http header
please tell me.....
thanks in advance
My problem is while creating RoUrlTranfer
i need to post one xml string along with querystring with the method POST and get responce string
How to set Post method in http header
please tell me.....
thanks in advance
5 REPLIES 5

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2012
12:53 PM
Re: how use GET/Post method in RoUrlTranfer
You would probably want to use the asyncpostfromstring() method of roURLTransfer.
- Joel
- Joel
babuhari123
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2012
11:25 PM
Re: how use GET/Post method in RoUrlTranfer
Thank Q for reply its working
Sike1234
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2012
08:01 AM
Re: how use GET/Post method in RoUrlTranfer
Can you share the code snippet ???
Thx
Thx


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2012
12:38 PM
Re: how use GET/Post method in RoUrlTranfer
"Sike1234" wrote:
Can you share the code snippet ???
Take a look at the http_post_from_string_with_timeout() function in the videoplayer sample.
babuhari123
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2012
02:25 AM
Re: how use GET/Post method in RoUrlTranfer
here the code
Function http_get_to_string_with_retry1() as Object
Pvar=privatevariables()
timeout% = 1500
num_retries% = 5
resHeaders = CreateObject("roAssociativeArray")
resArray = CreateObject("roArray", 5, false)
while num_retries% >
if (m.Http.AsyncPostFromString("Here you can post your string"))
event = wait(timeout%, m.Http.GetPort())
if type(event) = "roUrlEvent"
'print "***";event.GetInt();"***";event.GetResponseCode();"***";event.GetFailureReason();"***";event.GetSourceIdentity()
resArray.push(event.GetString())
resArray.push(event.GetResponseHeadersArray())
exit while
elseif event = invalid
m.Http.AsyncCancel()
REM reset the connection on timeouts
print"m.Http.GetUrl()",m.Http.GetUrl()
m.Http = CreateURLTransferObject(m.Http.GetUrl())
timeout% = 2 * timeout%
else
print "roUrlTransfer::AsyncGetToString(): unknown event"
endif
endif
num_retries% = num_retries% - 1
end while
return resArray[0]
End Function
Function http_get_to_string_with_retry1() as Object
Pvar=privatevariables()
timeout% = 1500
num_retries% = 5
resHeaders = CreateObject("roAssociativeArray")
resArray = CreateObject("roArray", 5, false)
while num_retries% >
if (m.Http.AsyncPostFromString("Here you can post your string"))
event = wait(timeout%, m.Http.GetPort())
if type(event) = "roUrlEvent"
'print "***";event.GetInt();"***";event.GetResponseCode();"***";event.GetFailureReason();"***";event.GetSourceIdentity()
resArray.push(event.GetString())
resArray.push(event.GetResponseHeadersArray())
exit while
elseif event = invalid
m.Http.AsyncCancel()
REM reset the connection on timeouts
print"m.Http.GetUrl()",m.Http.GetUrl()
m.Http = CreateURLTransferObject(m.Http.GetUrl())
timeout% = 2 * timeout%
else
print "roUrlTransfer::AsyncGetToString(): unknown event"
endif
endif
num_retries% = num_retries% - 1
end while
return resArray[0]
End Function