4 namespace dokuwiki\HTTP
;
9 * Adds DokuWiki specific configs to the HTTP client
11 * @author Andreas Goetz <cpuidle@gmx.de>
13 class DokuHTTPClient
extends HTTPClient
{
18 * @author Andreas Gohr <andi@splitbrain.org>
20 public function __construct(){
23 // call parent constructor
24 parent
::__construct();
26 // set some values from the config
27 $this->proxy_host
= $conf['proxy']['host'];
28 $this->proxy_port
= $conf['proxy']['port'];
29 $this->proxy_user
= $conf['proxy']['user'];
30 $this->proxy_pass
= conf_decodeString($conf['proxy']['pass']);
31 $this->proxy_ssl
= $conf['proxy']['ssl'];
32 $this->proxy_except
= $conf['proxy']['except'];
34 // allow enabling debugging via URL parameter (if debugging allowed)
35 if($conf['allowdebug']) {
37 isset($_REQUEST['httpdebug']) ||
39 isset($_SERVER['HTTP_REFERER']) &&
40 strpos($_SERVER['HTTP_REFERER'], 'httpdebug') !== false
50 * Wraps an event around the parent function
52 * @triggers HTTPCLIENT_REQUEST_SEND
53 * @author Andreas Gohr <andi@splitbrain.org>
57 * @param string|array $data the post data either as array or raw data
58 * @param string $method
61 public function sendRequest($url,$data='',$method='GET'){
62 $httpdata = array('url' => $url,
65 $evt = new \
Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata);
66 if($evt->advise_before()){
67 $url = $httpdata['url'];
68 $data = $httpdata['data'];
69 $method = $httpdata['method'];
73 return parent
::sendRequest($url,$data,$method);