DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:httpclient

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:httpclient [2009-02-08 17:41] – spelling 84.186.80.170devel:httpclient [2023-09-16 00:53] (current) Klap-in
Line 1: Line 1:
 ====== HTTPClient Library ====== ====== HTTPClient Library ======
  
-DokuWiki provides a library to access remote web servers without the need for any special PHP library (like CURL) or unsafe PHP settings (lik allow_url_fopen).+DokuWiki provides a library to access remote web servers without the need for any special PHP library (like CURL) or unsafe PHP settings (like ''allow_url_fopen'').
  
-Following features are supported:+The following features are supported:
  
   * Communication directly via network sockets   * Communication directly via network sockets
   * SSL support (if enabled in PHP)   * SSL support (if enabled in PHP)
-  * Configurable Timeouts +  * Configurable timeouts 
-  * Proxy Support+  * Proxy support
   * Redirect following   * Redirect following
-  * HTTP Header Parser +  * HTTP header parser 
-  * Basic Authentication +  * Basic authentication 
-  * Chunked Encoding+  * Chunked encoding
  
-The client is implemented in the class [[xref>HTTPClient]], but it is recommended to access the library through the [[xref>DokuHTTPClient]] subclass instead. This automatically configures the client correctly for using the [[config:proxy]] settings.+The client is implemented in the class [[xref>dokuwiki\HTTP\HTTPClient]], but it is recommended to access the library through the [[xref>dokuwiki\HTTP\DokuHTTPClient]] subclass instead. This automatically configures the client correctly for using the [[config:proxy]] settings.
  
 ===== Examples ===== ===== Examples =====
Line 21: Line 21:
  
 <code php> <code php>
-$http = new DokuHTTPClient() +$http = new dokuwiki\HTTP\DokuHTTPClient(); 
-$data = $http->get('http://www.google.com');+$data = $http->get('http://www.google.com/');
 echo $data; echo $data;
 </code> </code>
Line 29: Line 29:
  
 <code php> <code php>
 +use dokuwiki\HTTP\DokuHTTPClient;
 +
 // post data can be passed as associative array // post data can be passed as associative array
-$send = array( +$send = [ 
-    'q' => 'dokuwiki'; +    'p' => 'dokuwiki' 
-} +]; 
-$http = new DokuHTTPClient() +$http = new DokuHTTPClient(); 
-$data = $http->post('http://www.google.com');+$data = $http->post('http://search.yahoo.com/search', $send);
 echo $data; echo $data;
 </code> </code>
devel/httpclient.1234111304.txt.gz · Last modified: 2010-01-08 13:07 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki