new altURL Library V0.92
Chipp Walters
chipp at chipp.com
Mon Jan 28 23:37:00 EST 2002
I've posted a new version of the altURL library. It can be used instead of
the "post" and "get" commands when you need more control. I've used it
successfully on redirects, and it also makes it easy to manage HTTPresponse
callbacks. It's some pretty simple code -- easy to read -- for anyone who
wants more control of their sockets. It can be downloaded at:
http://www.altuit.com/webs/altuit2/RunRev/Downloads.htm
>From the documentation:
The altURL command posts form data and gets query data to / from a web
server using the POST and GET action of HTTP. It sends the completedMessage
when finished. The HTTP response can be accessed from the custom property
altURLResponse which can be checked in the completedMessage handler. This is
valuable in processing redirects as well as callbacks. There are two ways to
call this command. One is by passing separate values for all parameters, the
other is by merging all parameters into one URL?QueryString.
altURL ReqType, Host, Page, formList [,completedMessage]
altURLget URL?QueryString [,completedMessage]
altURLpost URL?QueryString [,completedMessage]
example:
altURL "POST","www.altuit.com","test.asp",myList,"myHTTPresponse"
altURL "GET","www.ibm.com","tst.asp","name=jack&pswd=123","dothing"
altURLget "http://www.ibm.com?name=jack&pswd=123","dothing"
altURLpost "http://www.ibm.com?name=jack&pswd=123","dothing"
Parameters:
The Host is a valid URL to a web server.
The Page is an valid Page request (typically an .asp,.jsp or cgi page).
The formList is a list of Form or QueryString Variables and their respective
contents. Each line of the list will have a name value pair. If you wish to
use spaces or special characters, be sure to URLencode them first.
ex. This list variable sends two name value pairs:
password=fred124
username=johnny
The completedMessage is an optional message sent to the stack upon
completion of the command.
The URL?Querystring is a valid URL with appended QueryString. Even though
this is typical in 'get' and not 'post' commands, here it generates both.
Note the http:// is required.
customProperties of altURL Lib:
altURLHeader - the header text being sent minus the Host and Page and
Content Length
altURLTimeOutSecs - the time in seconds for altPostSAFileUp to quit.
altURLresponse - the HTTP response sent from the server or empty if no
response. Use with the completedmessage parameter to get the HTTP response.
To install:
Copy the button altURL Lib into your stack. Then insert into the open stack
or startup handler of your stack:
insert the script of btn altURL Lib into back
Then you can call the altURL command from anywhere in your stack.
For more info contact Chipp Walters
Portions of this script used with permission of Jerry Daniels. Muchos
Gracias Jerry!
More information about the use-livecode
mailing list