2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. _scriptref_web:
|
|
|
|
|
|
|
|
Internet Functions
|
|
|
|
==================
|
|
|
|
|
|
|
|
OpenWebPage
|
2011-03-12 16:49:37 -05:00
|
|
|
~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure OpenWebPage(const url : string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
OpenWebPage opens the given web page (url) with your default browser.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
GetPage
|
2011-03-12 16:49:37 -05:00
|
|
|
~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function GetPage(const url : string): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
GetPage returns a string of HTML from the given web page.
|
|
|
|
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
InitializeHTTPClient
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function InitializeHTTPClient(HandleCookies: Boolean): Integer;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
InitializeHTTPClient creates a new client and assigns it an ID. You use this for
|
|
|
|
all the other web functions that require a client.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
InitializeHTTPClientWrap
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function InitializeHTTPClientWrap(HandleCookies: Boolean): Integer;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
This should probably not be documented.
|
|
|
|
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
FreeHTTPClient
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure FreeHTTPClient(Client: Integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
Free the HTTP client returned by *InitializeHTTPClient*.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
GetHTTPPage
|
2011-03-12 16:48:23 -05:00
|
|
|
~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function GetHTTPPage(Client: Integer;const URL: string): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
GetHTTPPage is just like GetPage, except you can choose which client to get the
|
|
|
|
HTTP code from.
|
|
|
|
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
SetHTTPUserAgent
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure SetHTTPUserAgent(Client: Integer;const Agent: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
SetHTTPUserAgent allows you to change the agent string of a client.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
PostHTTPPage
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function PostHTTPPage(Client: Integer;const Url,PostData: string): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
PostHTTPPage requests to post data (PostData) on the web page (Url) of the
|
|
|
|
client (Client).
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
PostHTTPPageEx
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function PostHTTPPageEx(Client: Integer;const Url: string): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
PostHTTPPageEx is just like PostHTTPPage but uses predefined post data added by
|
|
|
|
ddPostVariable and cleared by ClearPostData.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
ClearPostData
|
2011-03-12 16:48:23 -05:00
|
|
|
~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure ClearPostData(Client: Integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
ClearPostData clears the post data added to the web page (Client). Used with
|
|
|
|
PostHTTPPageEx.
|
|
|
|
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
AddPostVariable
|
2011-03-12 16:48:23 -05:00
|
|
|
~~~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure AddPostVariable(Client: Integer;const VarName, VarValue: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
AddPostVariable adds a post variable to the web page (Client). Used with
|
|
|
|
PostHTTPPageEx.
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
GetRawHeaders
|
2011-03-12 16:48:23 -05:00
|
|
|
~~~~~~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function GetRawHeaders(Client: Integer): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
GetRawHeaders returns a string of headers from the specified client.
|
|
|
|
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
SetProxy
|
2011-03-12 16:47:24 -05:00
|
|
|
~~~~~~~~
|
2010-09-09 11:19:29 -04:00
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
2011-03-12 16:47:24 -05:00
|
|
|
procedure SetProxy(Client : Integer; pHost, pPort : String);');
|
2010-09-09 11:19:29 -04:00
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
SetProxy configures a proxy with the given client (Client) proxy host (pHost)
|
|
|
|
and port (pPort).
|
2010-09-09 11:19:29 -04:00
|
|
|
|
2011-03-12 16:44:49 -05:00
|
|
|
CreateSocket
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function CreateSocket: integer;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
CreateSocket creates a new socket and assigns it an ID.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
FreeSocket
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure FreeSocket(Index: integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
FreeSocket frees the socket with the ID (Index) assigned to it upon creation.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
ConnectSocket
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure ConnectSocket(Client: integer; IP, Port: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
ConnectSocket connects the socket to an IP and port on the specified client
|
|
|
|
(Client).
|
|
|
|
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
BindSocket
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure BindSocket(Client: integer; IP, Port: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
BindSocket binds a connected socket to an IP and port on the specified client
|
|
|
|
(Client).
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
ListenSocket
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure ListenSocket(Client: integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
ListenSocket allows for a client socket to accept connections.
|
|
|
|
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
AcceptSocket
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function AcceptSocket(Client: integer): integer;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
AcceptSocket accepts pending connection requests to a client socket.
|
|
|
|
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
CloseSocket
|
|
|
|
~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure CloseSocket(Client: integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
CloseSocket closes connections to a client socket.
|
|
|
|
|
2011-03-12 16:44:49 -05:00
|
|
|
RecvSocket
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function RecvSocket(Client: integer): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
RecvSocket method reads all data waiting for read.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
RecvSocketStr
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
function RecvSocketStr(Client: integer): string;
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
Method waits until data string is received. This string is terminated by CR-LF
|
|
|
|
characters. The resulting string is returned without this termination (CR-LF)
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
RecvSocketEx
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
function RecvSocketEx(Client, Length: integer): string;
|
|
|
|
|
|
|
|
RecvSocketEx returns received data of a specified length from a bound socket as
|
|
|
|
a string.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
SendSocket
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure SendSocket(Client: integer; Data: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
SendSocket sends a string of data to a bound client socket.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
SetTimeout
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure SetTimeout(Client, Time: integer);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
SetTimeout sets a maximum amount of time for a bound client socket to wait for
|
|
|
|
data from another socket.
|
2011-03-12 16:44:49 -05:00
|
|
|
|
|
|
|
SocketInfo
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: pascal
|
|
|
|
|
|
|
|
procedure SocketInfo(Client: integer; out IP, Port: string);
|
|
|
|
|
2011-03-13 15:45:25 -04:00
|
|
|
SocketInfo sets where a bound socket will be sending data to (out IP, out Port).
|