LoadPostFile |
Internet | |
Aptilis 1 |
LoadPostFile(Url[,Vars])
LoadPostFile extends the capabilities of loadFile, to load the result of
a CGI programm, using POST and not GET as
loadFile does.
POST allows more parameters to be passed. Indeed, GET is often limited
to two hundred characters on some servers, and not much more on others.
LoadPostFile can pass variables in one of two ways:
- It will send all the variables available in the sub it's been called from.
OR:
- It will pass all the variables from a key based array passed as an optional
parameter. Use this method if there are some variables in your sub that
you do not wish to pass to the server.
Return Value:
A string containing the response from the server, in general a web page,
including the header.
An empty string in case of error and the _errno variable contains more details
about the error.
Example: 1
Using the variables of the calling sub
sub main // This examples uses example n.3 // Retrieving field data // All those settings are valid on my test PC url = "http://127.0.0.1/cgi-bin/aptilis.exe" $ file = "c:\\webshare\\scripts\\simple.e.txt" $ usersaid = "Bonjour le monde!" $ reply = loadPostFile(url$) $ print("reply 1:\n", reply$) end mainResult:
reply 1: HTTP/1.0 200 Ok Content-Type: text/html Server: Xitami Content-Length: 67 <html xmlns="http://www.w3.org/1999/xhtml"> <body> <b>you said:</b> Bonjour le monde!<body> </html> |
Example: 2
Using the variables from a key based array
sub main // This examples uses example n.3 // Retrieving field data // All those settings are valid on my test PC url = "http://127.0.0.1/cgi-bin/aptilis.exe" $ vars["file"] = "c:\\webshare\\scripts\\simple.e.txt" $ vars["usersaid"] = "Bonjour le monde!" $ reply = loadPostFile(url$, vars[]) $ print("reply 2:\n", reply$) end mainResult:
reply 2: HTTP/1.0 200 Ok Content-Type: text/html Server: Xitami Content-Length: 67 <html xmlns="http://www.w3.org/1999/xhtml"> <body> <b>you said:</b> Bonjour le monde!<body> </html> |
See also:
loadFile,
saveFile,
HTTPLoad,
HTTPPostLoad.