Main   Class List   Namespace List   Wiki

HTTPObject Class Reference
[Platform]

Allows communications between the game and a server using HTTP protocols. More...

Inheritance diagram for HTTPObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void get (string Address, string requirstURI, string query="")
 Send a GET command to a server to send or retrieve data.
void post (string Address, string requirstURI, string query, string post)
 Send POST command to a server to send or retrieve data.

Detailed Description

Allows communications between the game and a server using HTTP protocols.

Example:
// Create an HTTP object for communications
%newHTTPObj = new HTTPObject();

//  Transmit a get command with a specific server. Be sure to always include the port or the transfer will not work.
%newHTTPObj.get("www.garagegames.com:80","index.php");

// Callback from the engine. Called when the HTTPObject receives a response from the server, along with return data.
function HTTPObject.onLine(%this,%returnLine);
{
   echo("Data returned from the server = " @ %returnLine );
};

// DNS Resolved Response
HTTPObject::onDNSResolved(%this)
{
   // Do Code When DNS Resolved
}

// DNS Failed Resonse
HTTPObject::onDNSFailed(%this)
{
   // Do Code When DNS Failed
}

// Connected to Server Response
HTTPObject::onConnected(%this)
{
   // Do Code When Connected
}

// Connection to Server Failed
HTTPObject::onConnectFailed(%this)
{
   // Do Code When Connection Failed
}

// Disconnected from Server
HTTPObject::onDisconnected(%this)
{
   // Do Code When Disconnected
}

Member Function Documentation

void HTTPObject::get ( string  Address,
string  requirstURI,
string  query = "" 
)

Send a GET command to a server to send or retrieve data.

Parameters:
Address HTTP web address to send this get call to. Be sure to include the port at the end (IE: "www.garagegames.com:80").
requirstURI Specific location on the server to access (IE: "index.php".)
query Optional. Actual data to transmit to the server. Can be anything required providing it sticks with limitations of the HTTP protocol.
Example:
// Create an HTTP object for communications
%httpObj = new HTTPObject();

// Specify a URL to transmit to
%url = "www.garagegames.com";

// Specify a URI to communicate with
%URI = "/index.php";

// Specify a query to send.
%query = "";

// Send the GET command to the server
%httpObj.get(%url,%URI,%query);
void HTTPObject::post ( string  Address,
string  requirstURI,
string  query,
string  post 
)

Send POST command to a server to send or retrieve data.

Parameters:
Address HTTP web address to send this get call to. Be sure to include the port at the end (IE: "www.garagegames.com:80").
requirstURI Specific location on the server to access (IE: "index.php".)
query Actual data to transmit to the server. Can be anything required providing it sticks with limitations of the HTTP protocol.
post Submission data to be processed.
Example:
// Create an HTTP object for communications
%httpObj = new HTTPObject();

// Specify a URL to transmit to
%url = "www.garagegames.com";

// Specify a URI to communicate with
%URI = "/index.php";

// Specify a query to send.
%query = "";

// Specify the submission data.
%post = "";

// Send the POST command to the server
%httpObj.POST(%url,%URI,%query,%post);


Copyright © GarageGames, LLC. All Rights Reserved.