1: <?php
2: 3: 4: 5:
6: class Horde_Core_Factory_HttpClient extends Horde_Core_Factory_Base
7: {
8: 9: 10: 11: 12: 13: 14: 15:
16: public function create(array $opts = array())
17: {
18: global $conf;
19:
20: $client_opts = array();
21: if (!empty($conf['http']['proxy']['proxy_host'])) {
22: $client_opts['request.proxyServer'] = $conf['http']['proxy']['proxy_host'];
23: $client_opts['request.proxyPort'] = $conf['http']['proxy']['proxy_port'];
24: if (!empty($conf['http']['proxy']['proxy_user'])) {
25: $client_opts['request.proxyUsername'] = $conf['http']['proxy']['proxy_user'];
26: if (!empty($conf['http']['proxy']['proxy_pass'])) {
27: $client_opts['request.proxyPassword'] = $conf['http']['proxy']['proxy_pass'];
28: }
29: }
30: }
31: $opts['request.headers'] = array_merge(
32: empty($opts['request.headers']) ? array() : $opts['request.headers'],
33: array('Expect' => ''));
34: return new Horde_Http_Client(array_merge($client_opts, $opts));
35: }
36:
37: }
38: