[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <title>.: jsolait :. | documentation | urllib</title> 6 <link rel="stylesheet" type="text/css" href="./html.css" /> 7 <meta name="author" content="Jan-Klaas Kollhof" /> 8 <meta name="keywords" content="jsolait.urllib" /> 9 </head> 10 <body> 11 <a name="top" id="top"></a> 12 <div class="navigationBar"><a href="./index.xhtml">documentation</a> | 13 urllib</div> 14 <div class="menu"> 15 <ul></ul> 16 <div class="copyright">copyright © 2004, Jan-Klaas Kollhof</div> 17 </div> 18 <div class="content"> 19 <h1>Module urllib</h1> 20 Provides methods for making HTTP requests. 21 <br /> 22 The module is to be replaced by a richer <code>net</code> module, also containing sockets.<br /> 23 <div class="contentItem"><h2>public members:<a class="bttop" href="#top">▲</a></h2><div> 24 25 <h3>NoHTTPRequestObject()</h3><div class="indent"> 26 Exception thrown if no request object could be instanciated.<br /> 27 </div> 28 <h3>RequestOpenFailed()</h3><div class="indent"> 29 Exception thrown if an HTTP request could not be opened.<br /> 30 </div> 31 <h3>SendFailed()</h3><div class="indent"> 32 Exception thrown if a request could not be sent to the server.<br /> 33 </div> 34 <br /> 35 <h3>sendRequest(type,url,user,pass,data,headers,callback)</h3><div class="indent"> 36 Sends a request to a server.<br /> 37 To explain the way the optional arguments work I will give examples:<br /> 38 simple:<br /> 39 sendRequest("get", "url")<br /> 40 sendRequest("post", "url", "data")<br /> 41 <br /> 42 with headers:<br /> 43 sendRequest("get", "url", [["headername","value"]])<br /> 44 sendRequest("post", "url", "data", [["headername","value"]])<br /> 45 <br /> 46 with user information:<br /> 47 sendRequest("get", "url", "user", "pass")<br /> 48 sendRequest("post", "url", "user", "pass", "data")<br /> 49 <br /> 50 with headers and user information:<br /> 51 sendRequest("get", "url", "user", "pass", [["headername","value"]])<br /> 52 sendRequest("post", "url", "user", "pass", "data", [["headername","value"]])<br /> 53 <br /> 54 To make the request asynchronous just add a callback function as the last argument to the calls above.<br /> 55 <br /> 56 <b>type</b> Type of connection (GET, POST, ...).<br /> 57 <b>url</b> The URL to retrieve.<br /> 58 <b>user</b> =null The username for auth.<br /> 59 <b>pass</b> =null The password. (must be set if user is set!)<br /> 60 <b>data</b> ="" The data to send with the request.<br /> 61 <b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br /> 62 <b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br /> 63 <b>returns</b> HTTP request object.<br /> 64 </div> 65 <h3>getURL(url,user,pass,headers,callback)</h3><div class="indent"> 66 Shorthand for a GET request.<br /> 67 It calls sendRequest with "GET" as first argument.<br /> 68 See the sendRequest method for more information.<br /> 69 <br /> 70 <b>url</b> The URL to retrieve.<br /> 71 <b>user</b> =null The username for auth.<br /> 72 <b>pass</b> =null The password. (must be set if user is set!)<br /> 73 <b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br /> 74 <b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br /> 75 <b>returns</b> HTTP request object.<br /> 76 <br /> 77 </div> 78 <h3>postURL(url,user,pass,data,headers, callback)</h3><div class="indent"> 79 Shorthand for a POST request.<br /> 80 It calls sendRequest with "POST" as first argument.<br /> 81 See the sendRequest method for more information.<br /> 82 <br /> 83 <b>url</b> The URL to retrieve.<br /> 84 <b>user</b> =null The username for auth.<br /> 85 <b>pass</b> =null The password. (must be set if user is set!)<br /> 86 <b>data</b> ="" The data to send with the request.<br /> 87 <b>headers</b> =[] Array of headers. Each element in the array should be another array containing [headername,value].<br /> 88 <b>callback</b> =null Callback for asynchronous connections. The callback is called after completion and is passed the request object as 1st Parameter.<br /> 89 <b>returns</b> HTTP request object.<br /> 90 <br /> 91 </div> 92 </div></div> 93 <div class="contentItem"><h2>requirements<a class="bttop" href="#top">▲</a></h2><div> 94 95 The urllib requires the HTTPRequest object as fond in Mozilla and IE.<br /> 96 In SVG it will use ASV's getURL/postURL methods, but is limited to asynchronous connections.<br /> 97 98 </div></div> 99 </div> 100 </body> 101 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |