Creation/Dev/GScript/Requesthttp: Difference between revisions
From Graal Bible
m (Typo fix) |
No edit summary |
||
Line 16: | Line 16: | ||
{{code|1= | {{code|1= | ||
temp.req = requesthttp("graal.net" , 80 , "myfile.txt"); | <pre> | ||
this.catchevent(temp.req,"onReceiveData","onData"); | function requestData() { | ||
temp.req = requesthttp("graal.net" , 80 , "myfile.txt"); | |||
this.catchevent(temp.req,"onReceiveData","onData"); | |||
} | |||
function onData(dataobj) { | |||
echo("received data: " @ dataobj.data); | |||
} | |||
</pre> | |||
}} | }} | ||
Revision as of 05:08, 3 October 2006
Usage
requesthttp(host, port, file)
Parameters
host The name of the host server from which to make the HTTP request.
port The port in which to issue the request.
file The path and filename of the file being requested.
Returns
A THTTPRequest object.
Example
function requestData() { temp.req = requesthttp("graal.net" , 80 , "myfile.txt"); this.catchevent(temp.req,"onReceiveData","onData"); } function onData(dataobj) { echo("received data: " @ dataobj.data); } |
Description
Function; sends an HTTP request to a server and returns information about the file that was requested. It is identical to calling requesturl("http://" @ host @ ":" @ port @ file).