[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-http-proxy.php (summary)

HTTP API: WP_HTTP_Proxy class

File Size: 226 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_HTTP_Proxy:: (9 methods):
  is_enabled()
  use_authentication()
  host()
  port()
  username()
  password()
  authentication()
  authentication_header()
  send_through_proxy()


Class: WP_HTTP_Proxy  - X-Ref

Core class used to implement HTTP API proxy support.

There are caveats to proxy support. It requires that defines be made in the wp-config.php file to
enable proxy support. There are also a few filters that plugins can hook into for some of the
constants.

Please note that only BASIC authentication is supported by most transports.
cURL MAY support more methods (such as NTLM authentication) depending on your environment.

The constants are as follows:
<ol>
<li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
<li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
<li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
<li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
<li>WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
You do not need to have localhost and the site host in this list, because they will not be passed
through the proxy. The list should be presented in a comma separated list, wildcards using * are supported. Example: *.wordpress.org</li>
</ol>

An example can be as seen below.

define('WP_PROXY_HOST', '192.168.84.101');
define('WP_PROXY_PORT', '8080');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, *.wordpress.org');

is_enabled()   X-Ref
Whether proxy connection should be used.

Constants which control this behaviour:

- `WP_PROXY_HOST`
- `WP_PROXY_PORT`

return: bool
since: 2.8.0

use_authentication()   X-Ref
Whether authentication should be used.

Constants which control this behaviour:

- `WP_PROXY_USERNAME`
- `WP_PROXY_PASSWORD`

return: bool
since: 2.8.0

host()   X-Ref
Retrieve the host for the proxy server.

return: string
since: 2.8.0

port()   X-Ref
Retrieve the port for the proxy server.

return: string
since: 2.8.0

username()   X-Ref
Retrieve the username for proxy authentication.

return: string
since: 2.8.0

password()   X-Ref
Retrieve the password for proxy authentication.

return: string
since: 2.8.0

authentication()   X-Ref
Retrieve authentication string for proxy authentication.

return: string
since: 2.8.0

authentication_header()   X-Ref
Retrieve header string for proxy authentication.

return: string
since: 2.8.0

send_through_proxy( $uri )   X-Ref
Determines whether the request should be sent through a proxy.

We want to keep localhost and the site URL from being sent through the proxy, because
some proxies can not handle this. We also have the constant available for defining other
hosts that won't be sent through the proxy.

param: string $uri URL of the request.
return: bool Whether to send the request through the proxy.
since: 2.8.0



Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1