Translations of this page?:

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).

Following features are supported:

  • Communication directly via network sockets
  • SSL support (if enabled in PHP)
  • Configurable Timeouts
  • Proxy Support
  • Redirect following
  • HTTP Header Parser
  • Basic Authentication
  • Chunked Encoding

The client is implemented in the class HTTPClient, but it is recommended to access the library through the DokuHTTPClient subclass instead. This automatically configures the client correctly for using the proxy settings.

Examples

Simple GET

$http = new DokuHTTPClient();
$data = $http->get('http://www.google.com/');
echo $data;

Simple POST

// post data can be passed as associative array
$send = array(
    'p' => 'dokuwiki'
);
$http = new DokuHTTPClient();
$data = $http->post('http://search.yahoo.com/search', $send);
echo $data;
devel/httpclient.txt · Last modified: 2010/01/08 13:07 by kazmiya
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate