SRL Archive - Simba Tasks

[DONE] Web Documentation [Quite Easy]


Wizzup?

2011-03-12 16:55:15

Same as the other documentation. Needs to be filled in.

http://docs.wizzup.org/simba/scriptref/web.html

Echo_

2011-03-13 10:45:55

I tested all of these out in Simba to write a proper description, so here's what I came up with.
procedure OpenWebPage(const url : string);
OpenWebPage opens the given web page (url) with your default browser.

function GetPage(const url : string): string;
GetPage returns a string of HTTP code from the given web page.

function InitializeHTTPClient(HandleCookies: Boolean): Integer;
InitializeHTTPClient creates a new client and assigns it an ID.

function InitializeHTTPClientWrap(HandleCookies: Boolean): Integer;
~

procedure FreeHTTPClient(Client: Integer);
FreeHTTPClient frees the client with the ID (Client) assigned to it upon creation.

function GetHTTPPage(Client: Integer;const URL: string): string;
GetHTTPPage is just like GetPage, except you can choose which client to get the HTTP code from.

procedure SetHTTPUserAgent(Client: Integer;const Agent: string);
SetHTTPUserAgent allows you to change the agent string of a client.

function PostHTTPPage(Client: Integer;const Url,PostData: string): string;
PostHTTPPage requests to post data (PostData) on the web page (Url) of the client (Client).

function PostHTTPPageEx(Client: Integer;const Url: string): string;
PostHTTPPageEx is just like PostHTTPPage but uses predefined post data added by ClearPostData and AddPostVariable.

procedure ClearPostData(Client: Integer);
ClearPostData clears the post data added to the web page (Client). Used with PostHTTPPageEx.

procedure AddPostVariable(Client: Integer;const VarName, VarValue: string);
AddPostVariable adds a post variable to the web page (Client). Used with PostHTTPPageEx.

function GetRawHeaders(Client: Integer): string;
GetRawHeaders returns a string of headers from the specified client.

procedure SetProxy(Client : Integer; pHost, pPort : String);
SetProxy configures a proxy with the given client (Client) proxy host (pHost) and port (pPort).

function CreateSocket: integer;
CreateSocket creates a new socket and assigns it an ID.

procedure FreeSocket(Index: integer);
FreeSocket frees the socket with the ID (Index) assigned to it upon creation.

procedure ConnectSocket(Client: integer; IP, Port: string);
ConnectSocket connects the socket to an IP and port on the specified client (Client).

procedure BindSocket(Client: integer; IP, Port: string);
BindSocket binds a connected socket to an IP and port on the specified client (Client).

procedure ListenSocket(Client: integer);
ListenSocket allows for a client socket to accept connections.

function AcceptSocket(Client: integer): integer;
AcceptSocket accepts pending connection requests to a client socket.

procedure CloseSocket(Client: integer);
CloseSocket closes connections to a client socket.

function RecvSocket(Client: integer): string;
RecvSocket returns received data from a bound client socket as a string.

function RecvSocketStr(Client: integer): string;
~

function RecvSocketEx(Client, Length: integer): string;
RecvSocketEx returns received data of a specified length from a bound socket as a string.

procedure SendSocket(Client: integer; Data: string);
SendSocket sends a string of data to a bound client socket.

procedure SetTimeout(Client, Time: integer);
SetTimeout sets a maximum amount of time for a bound client socket to wait for data from another socket.

procedure SocketInfo(Client: integer; out IP, Port: string);
SocketInfo sets where a bound socket will be sending data to (out IP, out Port).

Feel free to change any of the descriptions if they aren't specific enough or are incorrect. I didn't know what "InitializeHTTPClientWrap" and "RecvSocketStr" did unfortunately, so they are left blank :(

Wizzup?

2011-03-13 15:46:16

Awesome, good job!!!

I've added it, replaced only a few words and added RecvStr documentation.

Again, it's nice to see someone contribute! :)

http://docs.wizzup.org/simba/scriptref/web.html

Echo_

2011-03-13 15:51:38

Cool, glad I could help :)