HTTP POST help

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TrevorDowdle
Posts: 16
Joined: Tue Jul 10, 2012 4:37 pm

HTTP POST help

Post by TrevorDowdle » Wed Jul 11, 2012 3:37 pm

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

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: HTTP POST help

Post by gpb01 » Wed Jul 11, 2012 4:52 pm

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

TrevorDowdle
Posts: 16
Joined: Tue Jul 10, 2012 4:37 pm

Re: HTTP POST help

Post by TrevorDowdle » Wed Jul 11, 2012 5:31 pm

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: HTTP POST help

Post by sturgis » Wed Jul 11, 2012 5:39 pm

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

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: HTTP POST help

Post by gpb01 » Wed Jul 11, 2012 6:28 pm

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

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: HTTP POST help

Post by sturgis » Wed Jul 11, 2012 6:33 pm

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

TrevorDowdle
Posts: 16
Joined: Tue Jul 10, 2012 4:37 pm

Re: HTTP POST help

Post by TrevorDowdle » Wed Jul 11, 2012 9:24 pm

Okay Perfect,

Thanks again both of you for your help!

Post Reply