Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cHttpRequest
  • cHttpRequestCurl
  • cHttpRequestSocket
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the the general HttpRequest class
  4:  * Extends this class and implement the functions to use
  5:  * other methods of doing HTTP requests
  6:  *
  7:  * @package Core
  8:  * @subpackage Core
  9:  * @version SVN Revision $Rev:$
 10:  *
 11:  * @author Mischa Holz
 12:  * @copyright four for business AG <www.4fb.de>
 13:  * @license http://www.contenido.org/license/LIZENZ.txt
 14:  * @link http://www.4fb.de
 15:  * @link http://www.contenido.org
 16:  */
 17: 
 18: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 19: 
 20: /**
 21:  * Abstract HttpRequest class
 22:  *
 23:  * @package Core
 24:  * @subpackage Core
 25:  */
 26: abstract class cHttpRequest {
 27: 
 28:     /**
 29:      * Creates a new cHttpRequest object.
 30:      * The function determines the best extension to use and returns an object accordingly
 31:      *
 32:      * @param string $url URL of the HTTP request
 33:      * @return object extends cHttpRequest
 34:      */
 35:     public static function getHttpRequest($url = '') {
 36:         $className = 'cHttpRequestCurl';
 37:         if (!function_exists('curl_exec') || CURLOPT_RETURNTRANSFER != 19913) {
 38:             $className = 'cHttpRequestSocket';
 39:         }
 40: 
 41:         return new $className($url);
 42:     }
 43: 
 44:     /**
 45:      * Basic constructor
 46:      *
 47:      * @param string $url URL of the HTTP request
 48:      */
 49:     abstract public function __construct($url = '');
 50: 
 51:     /**
 52:      * Peform the request using POST
 53:      *
 54:      * @param bool $return If true, response of the server gets returned as string
 55:      * @param bool $returnHeaders If true, headers will be included in the response
 56:      *
 57:      * @return string|bool False on error, response otherwise
 58:      */
 59:     abstract public function postRequest($return = true, $returnHeaders = false);
 60: 
 61:     /**
 62:      * Peform the request using GET
 63:      *
 64:      * @param bool $return If true, response of the server gets returned as string
 65:      * @param bool $returnHeaders If true, headers will be included in the response
 66:      *
 67:      * @return string|bool False on error, response otherwise
 68:      */
 69:     abstract public function getRequest($return = true, $returnHeaders = false);
 70: 
 71:     /**
 72:      * Peform the request using POST AND append all GET parameters
 73:      *
 74:      * @param bool $return If true, response of the server gets returned as string
 75:      * @param bool $returnHeaders If true, headers will be included in the response
 76:      *
 77:      * @return string|bool False on error, response otherwise
 78:      */
 79:     abstract public function request($return = true, $returnHeaders = false);
 80: 
 81:     /**
 82:      * Set the GET parameters
 83:      *
 84:      * @param array $array An associative array containing keys and values of the GET parameters
 85:      */
 86:     abstract public function setGetParams($array);
 87: 
 88:     /**
 89:      * Set the POST parameters
 90:      *
 91:      * @param array $array An associative array containing keys and values of the POST parameters
 92:      */
 93:     abstract public function setPostParams($array);
 94: 
 95:     /**
 96:      * Set the HTTP headers
 97:      *
 98:      * @param array $array An associative array containing the HTTP headers
 99:      */
100:     abstract public function setHeaders($array);
101: 
102:     /**
103:      * Set the request URL
104:      *
105:      * @param string $url the URL
106:      */
107:     abstract public function setURL($url);
108: }
109: 
110: ?>
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0