FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing-docs/generate/domit/php_http_proxy.php at master · processing/processing-docs · GitHub
processing
processing-docs
Repository navigation
Code
Issues
3
(3)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing-docs
/
generate
/
domit
/
php_http_proxy.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (69 loc) · 2.47 KB
Breadcrumbs
processing-docs
/
generate
/
domit
/
php_http_proxy.php
Copy path
File metadata and controls
78 lines (69 loc) · 2.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* PHP HTTP Tools is a library for working with the http protocol
* php_http_proxy represents a basic http proxy
* @package php-http-tools
* @version 0.2-pre
* @copyright (C) 2004 John Heinstein. All rights reserved
* @license http://www.gnu.org/copyleft/lesser.html LGPL License
* @author John Heinstein <johnkarl@nbnet.nb.ca>
* @link http://www.engageinteractive.com/php_http_tools/ PHP HTTP Tools Home Page
* PHP HTTP Tools are Free Software
**/
if
(!
defined
(
'
PHP_HTTP_TOOLS_INCLUDE_PATH
'
)) {
define
(
'
PHP_HTTP_TOOLS_INCLUDE_PATH
'
, (
dirname
(
__FILE__
) .
"
/
"
));
}
require_once
(
PHP_HTTP_TOOLS_INCLUDE_PATH
.
'
php_http_client_generic.php
'
);
/**
* An HTTP Proxy class
*
* @package php-http-tools
* @author John Heinstein <johnkarl@nbnet.nb.ca>
*/
class
php_http_proxy
extends
php_http_client_generic {
/**
* HTTP Proxy constructor
* @param string The client connection host name, with or without its protocol prefix
* @param string The client connection path, not including the host name
* @param int The port to establish the client connection on
* @param int The timeout value for the client connection
*/
function
php_http_proxy
(
$
host
,
$
path
=
'
/
'
,
$
port
=
80
,
$
timeout
=
0
) {
$
this
->
php_http_client_generic
(
$
host
,
$
path
,
$
port
,
$
timeout
);
$
this
->
setHeaders
();
}
//php_http_proxy
/**
* Sets the proxy timeout to the specified value
* @param int The timeout value for the client connection
*/
function
setTimeout
(
$
timeout
) {
$
this
->
timeout
=
$
timeout
;
}
//setTimeout
/**
* Sets the proxy headers
*/
function
setHeaders
() {
$
this
->
setHeader
(
'
User-Agent
'
,
'
PHP-HTTP-Proxy-Client/0.1
'
);
$
this
->
setHeader
(
'
Connection
'
,
'
Close
'
);
}
//setHeaders
/**
* Specifies a user name and password for basic proxy authentication
* @param string The user name for proxy authentication
* @param string The password for proxy authentication
*/
function
setProxyAuthorization
(
$
user
,
$
password
) {
$
encodedChallengeResponse
=
'
Basic
'
.
base64_encode
(
$
this
->
user
.
'
:
'
.
$
this
->
password
);
$
this
->
setHeader
(
'
Proxy-Authorization
'
,
$
encodedChallengeResponse
);
}
//setProxyAuthorization
/**
* Handler for customizing the HTTP GET call
* @param string The target url
*/
function
get_custom
(
$
filename
) {
$
url
=
$
this
->
connection
->
formatHost
(
$
filename
);
$
sep
=
strpos
(
$
url
,
'
/
'
);
$
targetHost
=
substr
(
$
url
,
0
,
$
sep
);
$
this
->
setHeader
(
'
Host
'
,
$
targetHost
);
}
//get_custom
}
//php_http_proxy
?>
Back
|
FazBrowse Home
|
New Git URL