Page 1 of 1

URL encode post to web

Posted: Tue Apr 09, 2013 1:04 am
by reelstuff
I have a basic example of a method of posting to a server online, in the following manner.

Code: Select all

username=_YOUR_ACCOUNT_USERNAME_&pass=_YOUR_ACCOUNT_PASSWORD_&XXid=_XX_ID_&message=_MESSSAGE_&topics=_COMMA_SEPARATED_TOPIC_NAMES
So if I were to use the

Code: Select all

#URLEncode method would it work something like this?

put tURL into my_new_URL_Var

URLEncode my_new_URL_Var

put it into eURL

post eURL

Re: URL encode post to web

Posted: Tue Apr 09, 2013 1:10 am
by Simon
Hi reelstuff,
What is your question?
(tip: they normally are followed by this "?" symbol). :D

Simon

Re: URL encode post to web

Posted: Tue Apr 09, 2013 1:15 am
by sturgis
In this case, you need to urlencode the data only. You need to leave the = signs alone, and urlencode will mess with them.

If you are working on the desktop, probably the easiest way to accomplish your goal is to use the liburlformdata() function. It takes arguments in sets of 2, separated by comma.

so from your example something like this:

Code: Select all

put libUrlFormData("username","YOUR_ACCOUNT_USERNAME","pass","YOUR_ACCOUNT_PASSWORD","id","_XX_ID_","message","_message_","topics","TOPIC NAMES") into tData

post tData to url "http://your.url.com/whatever.php"
If your data is in variable names you can use those instead of a directly typed string like I did...
So instead of "YourAccountNameBlahBlah"
just put in tUsername

And as you can see above, you POST the data TO the url.

Re: URL encode post to web

Posted: Tue Apr 09, 2013 1:48 am
by reelstuff
Edit,

after playing around with URLEncode, and setting variables, I ran into something rather strange, it appears that messages are not being passed between scripts, in the same control or card script, it has been some time since I have used LC, but this seems like an odd way to behave as well, it appears that the focus is moving to the inspector instead of the card as it should perhaps a reboot is in order, hmmm,