[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 /** 3 * PHP HTTP Tools is a library for working with the http protocol 4 * php_http_proxy represents a basic http proxy 5 * @package php-http-tools 6 * @version 0.3 7 * @copyright (C) 2004 John Heinstein. All rights reserved 8 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 9 * @author John Heinstein <johnkarl@nbnet.nb.ca> 10 * @link http://www.engageinteractive.com/php_http_tools/ PHP HTTP Tools Home Page 11 * PHP HTTP Tools are Free Software 12 **/ 13 if (!defined('PHP_HTTP_TOOLS_INCLUDE_PATH')) { 14 define('PHP_HTTP_TOOLS_INCLUDE_PATH', (dirname(__FILE__) . "/")); 15 } 16 17 require_once (PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_client_generic.php'); 18 19 /** 20 * An HTTP Proxy class 21 * 22 * @package php-http-tools 23 * @author John Heinstein <johnkarl@nbnet.nb.ca> 24 */ 25 class php_http_proxy extends php_http_client_generic { 26 27 /** 28 * HTTP Proxy constructor 29 * @param string The client connection host name, with or without its protocol prefix 30 * @param string The client connection path, not including the host name 31 * @param int The port to establish the client connection on 32 * @param int The timeout value for the client connection 33 */ 34 function php_http_proxy($host, $path = '/', $port = 80, $timeout = 0) { 35 $this->php_http_client_generic($host, $path, $port, $timeout); 36 $this->setHeaders(); 37 } //php_http_proxy 38 39 /** 40 * Sets the proxy timeout to the specified value 41 * @param int The timeout value for the client connection 42 */ 43 function setTimeout($timeout) { 44 $this->timeout = $timeout; 45 } //setTimeout 46 47 /** 48 * Sets the proxy headers 49 */ 50 function setHeaders() { 51 $this->setHeader('User-Agent', 'PHP-HTTP-Proxy-Client/0.1'); 52 $this->setHeader('Connection', 'Close'); 53 } //setHeaders 54 55 /** 56 * Specifies a user name and password for basic proxy authentication 57 * @param string The user name for proxy authentication 58 * @param string The password for proxy authentication 59 */ 60 function setProxyAuthorization($user, $password) { 61 $encodedChallengeResponse = 'Basic ' . base64_encode($this->user . ':' . $this->password); 62 $this->setHeader('Proxy-Authorization', $encodedChallengeResponse); 63 } //setProxyAuthorization 64 65 /** 66 * Handler for customizing the HTTP GET call 67 * @param string The target url 68 */ 69 function get_custom($filename) { 70 $url = $this->connection->formatHost($filename); 71 $sep = strpos($url, '/'); 72 $targetHost = substr($url, 0, $sep); 73 74 $this->setHeader('Host', $targetHost); 75 } //get_custom 76 } //php_http_proxy 77 78 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |