mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-17 20:21:18 +01:00
102 lines
6.8 KiB
HTML
102 lines
6.8 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<title>.: jsolait :. | documentation | urllib</title>
|
|
<link rel="stylesheet" type="text/css" href="./html.css" />
|
|
<meta name="author" content="Jan-Klaas Kollhof" />
|
|
<meta name="keywords" content="jsolait.urllib" />
|
|
</head>
|
|
<body>
|
|
<a name="top" id="top"></a>
|
|
<div class="navigationBar"><a href="./index.xhtml">documentation</a> |
|
|
urllib</div>
|
|
<div class="menu">
|
|
<ul></ul>
|
|
<div class="copyright">copyright © 2004, Jan-Klaas Kollhof</div>
|
|
</div>
|
|
<div class="content">
|
|
<h1>Module urllib</h1>
|
|
Provides methods for making HTTP requests.
|
|
<br />
|
|
The module is to be replaced by a richer <code>net</code> module, also containing sockets.<br />
|
|
<div class="contentItem"><h2>public members:<a class="bttop" href="#top">▲</a></h2><div>
|
|
|
|
<h3>NoHTTPRequestObject()</h3><div class="indent">
|
|
Exception thrown if no request object could be instanciated.<br />
|
|
</div>
|
|
<h3>RequestOpenFailed()</h3><div class="indent">
|
|
Exception thrown if an HTTP request could not be opened.<br />
|
|
</div>
|
|
<h3>SendFailed()</h3><div class="indent">
|
|
Exception thrown if a request could not be sent to the server.<br />
|
|
</div>
|
|
<br />
|
|
<h3>sendRequest(type,url,user,pass,data,headers,callback)</h3><div class="indent">
|
|
Sends a request to a server.<br />
|
|
To explain the way the optional arguments work I will give examples:<br />
|
|
simple:<br />
|
|
sendRequest("get", "url")<br />
|
|
sendRequest("post", "url", "data")<br />
|
|
<br />
|
|
with headers:<br />
|
|
sendRequest("get", "url", [["headername","value"]])<br />
|
|
sendRequest("post", "url", "data", [["headername","value"]])<br />
|
|
<br />
|
|
with user information:<br />
|
|
sendRequest("get", "url", "user", "pass")<br />
|
|
sendRequest("post", "url", "user", "pass", "data")<br />
|
|
<br />
|
|
with headers and user information:<br />
|
|
sendRequest("get", "url", "user", "pass", [["headername","value"]])<br />
|
|
sendRequest("post", "url", "user", "pass", "data", [["headername","value"]])<br />
|
|
<br />
|
|
To make the request asynchronous just add a callback function as the last argument to the calls above.<br />
|
|
<br />
|
|
<b>type</b> Type of connection (GET, POST, ...).<br />
|
|
<b>url</b> The URL to retrieve.<br />
|
|
<b>user</b> =null The username for auth.<br />
|
|
<b>pass</b> =null The password. (must be set if user is set!)<br />
|
|
<b>data</b> ="" The data to send with the request.<br />
|
|
<b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br />
|
|
<b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br />
|
|
<b>returns</b> HTTP request object.<br />
|
|
</div>
|
|
<h3>getURL(url,user,pass,headers,callback)</h3><div class="indent">
|
|
Shorthand for a GET request.<br />
|
|
It calls sendRequest with "GET" as first argument.<br />
|
|
See the sendRequest method for more information.<br />
|
|
<br />
|
|
<b>url</b> The URL to retrieve.<br />
|
|
<b>user</b> =null The username for auth.<br />
|
|
<b>pass</b> =null The password. (must be set if user is set!)<br />
|
|
<b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br />
|
|
<b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br />
|
|
<b>returns</b> HTTP request object.<br />
|
|
<br />
|
|
</div>
|
|
<h3>postURL(url,user,pass,data,headers, callback)</h3><div class="indent">
|
|
Shorthand for a POST request.<br />
|
|
It calls sendRequest with "POST" as first argument.<br />
|
|
See the sendRequest method for more information.<br />
|
|
<br />
|
|
<b>url</b> The URL to retrieve.<br />
|
|
<b>user</b> =null The username for auth.<br />
|
|
<b>pass</b> =null The password. (must be set if user is set!)<br />
|
|
<b>data</b> ="" The data to send with the request.<br />
|
|
<b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br />
|
|
<b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br />
|
|
<b>returns</b> HTTP request object.<br />
|
|
<br />
|
|
</div>
|
|
</div></div>
|
|
<div class="contentItem"><h2>requirements<a class="bttop" href="#top">▲</a></h2><div>
|
|
|
|
The urllib requires the HTTPRequest object as fond in Mozilla and IE.<br />
|
|
In SVG it will use ASV's getURL/postURL methods, but is limited to asynchronous connections.<br />
|
|
|
|
</div></div>
|
|
</div>
|
|
</body>
|
|
</html>
|