Page 1 of 1

HTTP POST help

Posted: Wed Jul 11, 2012 3:37 pm
by TrevorDowdle
Hey, I have a few questions I am stuck on, and would greatly appreciate your help.

1. From what I have seen the command - launch url "abc.xyz" will open up the default browser on the system. I did some research and it seems to be possible to do it internally on mobile IOS devices. From what I have seen in the "how do i use the browser control" lesson.
Is there any other way to display a web browser within live code, so that it will work with more then just IOS?

2. Wether the browser is launched internally or externally, is there a way to post data to a server?

I am trying to post a XML document/string to a server.

The Content type is - application/x-www-form-urlencoded

The encoding is - utf-8

How could I accomplish this in livecode?

Thanks

Re: HTTP POST help

Posted: Wed Jul 11, 2012 4:52 pm
by gpb01
Hi,
if you look into the dictionary you can find the "post" command which do an HTTP POST.

You have to setup all the elements on your header using the "httpHeaders" propery and you have to create the correct application/x-www-form-urlencoded block of data to send.

For the browser, you can create a native browser ... look inside the LiveCodeNotes for iOS.

Guglielmo

Re: HTTP POST help

Posted: Wed Jul 11, 2012 5:31 pm
by TrevorDowdle
Thanks for the information gpb01,

I do have another question about the browser though.
For the browser, you can create a native browser ... look inside the LiveCodeNotes for iOS.
What about a solution for all devices not just iOS?

Does anyone have a simple example of a browser?

I found one in the help->Example Stacks and Resources -> Resources/Examples/Browser Sampler.rev

But when I navigate to googlecom for some reason the search box is black and you can't see what your typing into it. Has anyone ran into the same problem?

Thanks

Re: HTTP POST help

Posted: Wed Jul 11, 2012 5:39 pm
by sturgis
revbrowser is available for osx and win, unless its changed recently, no browser external for linux yet.

You'll have to segregate your code by checking the current platform then act accordingly. if the environment is "mobile" then use the mobile code... else use the desktop code

Re: HTTP POST help

Posted: Wed Jul 11, 2012 6:28 pm
by gpb01
TrevorDowdle wrote:Thanks for the information gpb01,
.....
.....
As "sturgis" say, you have to test "the environment" and, probably, also "the platform" to identify where your program is running and then using the correct functions to create, where is possible, the browser window.

On Mac and Win you have to use the revBrowser commands, on iOS you have to use the "iphoneControlCreate" and the "iphonoeControlSet" commands, on Android ... I don't know ... newer done :D

Guglielmo

Re: HTTP POST help

Posted: Wed Jul 11, 2012 6:33 pm
by sturgis
The generic now is mobilecontrolcreate etc and should work on both ios and android.
EDIT: This depends on the LC version too of course.
gpb01 wrote:
TrevorDowdle wrote:Thanks for the information gpb01,
.....
.....
As "sturgis" say, you have to test "the environment" and, probably, also "the platform" to identify where your program is running and then using the correct functions to create, where is possible, the browser window.

On Mac and Win you have to use the revBrowser commands, on iOS you have to use the "iphoneControlCreate" and the "iphonoeControlSet" commands, on Android ... I don't know ... newer done :D

Guglielmo

Re: HTTP POST help

Posted: Wed Jul 11, 2012 9:24 pm
by TrevorDowdle
Okay Perfect,

Thanks again both of you for your help!