[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/includes/domit/ -> php_http_connector.php (source)

   1  <?php
   2  /**

   3  * PHP HTTP Tools is a library for working with the http protocol

   4  * php_http_connector establishes http connections

   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  
  14  if (!defined('PHP_HTTP_TOOLS_INCLUDE_PATH')) {
  15      define('PHP_HTTP_TOOLS_INCLUDE_PATH', (dirname(__FILE__) . "/"));
  16  }
  17  
  18  /**

  19  * A helper class for establishing HTTP connections

  20  *

  21  * @package php-http-tools

  22  * @author John Heinstein <johnkarl@nbnet.nb.ca>

  23  */
  24  class php_http_connector {
  25      /** @var object A reference to a http connection or proxy, if one is required */

  26      var $httpConnection = null;
  27  
  28      /**

  29      * Specifies the parameters of the http conection used to obtain the xml data

  30      * @param string The ip address or domain name of the connection

  31      * @param string The path of the connection

  32      * @param int The port that the connection is listening on

  33      * @param int The timeout value for the connection

  34      * @param string The user name, if authentication is required

  35      * @param string The password, if authentication is required

  36      */
  37  	function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) {
  38          require_once (PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_client_generic.php');
  39  
  40          $this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password);
  41      } //setConnection

  42  
  43      /**

  44      * Specifies basic authentication for an http connection

  45      * @param string The user name

  46      * @param string The password

  47      */
  48  	function setAuthorization($user, $password) {
  49          $this->httpConnection->setAuthorization($user, $password);
  50      } //setAuthorization

  51  
  52      /**

  53      * Specifies that a proxy is to be used to obtain the data

  54      * @param string The ip address or domain name of the proxy

  55      * @param string The path to the proxy

  56      * @param int The port that the proxy is listening on

  57      * @param int The timeout value for the connection

  58      * @param string The user name, if authentication is required

  59      * @param string The password, if authentication is required

  60      */
  61  	function setProxyConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) {
  62          require_once (PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_proxy.php');
  63  
  64          $this->httpConnection = new php_http_proxy($host, $path, $port, $timeout, $user, $password);
  65      } //setProxyConnection

  66  
  67      /**

  68      * Specifies basic authentication for the proxy

  69      * @param string The user name

  70      * @param string The password

  71      */
  72  	function setProxyAuthorization($user, $password) {
  73          $this->httpConnection->setProxyAuthorization($user, $password);
  74      } //setProxyAuthorization

  75  } //php_http_connector

  76  
  77  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics