Creation/Dev/GScript/Requesthttp: Difference between revisions
From Graal Bible
No edit summary |
Pooper200000 (talk | contribs) No edit summary |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Scripting Reference]] | |||
{{doctitle|Usage}} | |||
requesthttp({{graycourier|host}}, {{graycourier|port}}, {{graycourier|file}}) | requesthttp({{graycourier|host}}, {{graycourier|port}}, {{graycourier|file}}) | ||
{{doctitle|Parameters}} | |||
{{graycourier|host}} The name of the host server from which to make the HTTP request.<br /> | {{graycourier|host}} The name of the host server from which to make the HTTP request.<br /> | ||
Line 9: | Line 10: | ||
{{graycourier|file}} The path and filename of the file being requested. | {{graycourier|file}} The path and filename of the file being requested. | ||
{{doctitle|Returns}} | |||
A THTTPRequest object. | A [[Creation/Dev/Script/Client/THTTPRequest|THTTPRequest]] object. | ||
{{doctitle|Example}} | |||
Function; sends an HTTP request to a server and returns information about the file that was requested. | {{code|1= | ||
<pre> | |||
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> | |||
}} | |||
{{doctitle|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://" @ {{graycourier|host}} @ ":" @ {{graycourier|port}} @ {{graycourier|file}}). |
Latest revision as of 01:56, 12 September 2009
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).