Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Http
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class Http

Http component that wraps cURL

Package: blesta\components\net\http
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at components/net/http/http.php
Methods summary
public
# __construct( )

Creates a new NetHttp object, initializes a curl instance

Creates a new NetHttp object, initializes a curl instance

public
# __destruct( )

Closes the current curl instance, if open

Closes the current curl instance, if open

public
# open( )

Explicitly open the curl instance, and close any open instance

Explicitly open the curl instance, and close any open instance

public
# close( )

Explicitly close the curl instance, if open

Explicitly close the curl instance, if open

public
# persistenConnection( boolean $persist )

Set whether or not this connection should be persistent

Set whether or not this connection should be persistent

Parameters

$persist
True to persist, false not to.
public string
# get( string $url, mixed $params = null )

Execute a GET request on the given URL

Execute a GET request on the given URL

Parameters

$url
The URL to GET
$params
An array of key/value pairs, or a string of the format key=value&...

Returns

string
The response from the URL

See

NetHttp::responseCode()
public string
# post( string $url, mixed $params = null, array $files = null )

Execut a POST request on the given URL

Execut a POST request on the given URL

Parameters

$url
The URL to POST to
$params
An array of key/value pairs, or a string of the format key=value&... (optional)
$files

A multi-dimensional array of files in the format of [0]=>array("name"=>"Name of file", "file"=>"File path")

Returns

string
The response from the URL

See

NetHttp::responseCode()
public integer
# responseCode( )

Fetch the response code for that last request

Fetch the response code for that last request

Returns

integer
The HTTP response code for that last request
public
# setCookieFile( string $cookie_file )

Set the cookie file to use for this request

Set the cookie file to use for this request

Parameters

$cookie_file
file name of the cookie file to set

Throws

Exception
thrown when the given $cookie_file does not exist
public
# setHeaders( array $headers )

Set an array of headers, overwritting existing header data

Set an array of headers, overwritting existing header data

Parameters

$headers
Headers of the format array("Content Type: text/html", "...")
public
# setHeader( string $header )

Set a header value, appending it to the existing header data

Set a header value, appending it to the existing header data

Parameters

$header
Header string of the format "Content Type: text/html"
public
# setTimeout( integer $seconds )

Set the timeout for the current request

Set the timeout for the current request

Parameters

$seconds
The number of seconds to wait before timing out
public
# setOption( integer $option, string $value, boolean $override = true )

Set the given $option and $value. Accepts CURLOPT_* options.

Set the given $option and $value. Accepts CURLOPT_* options.

Parameters

$option
The CURLOPT_* option to set
$value
The value to set
$override
True to override the existing value, otherwise will only set the value if not already set
public string
# request( string $method, string $url, mixed $params = null )

Processes the request using the given method and URL, with optional urlencoded parameters

Processes the request using the given method and URL, with optional urlencoded parameters

Parameters

$method
The request method (e.g. GET, POST, PUT, DELETE, etc.)
$url
The URL to requets
$params
An array of parametes or a URL encoded string of parameters

Returns

string
The response from the URL

See

NetHttp::responseCode()
public
# debug( resource $debug_stream )

Enables debugging, which is sent to the given stream

Enables debugging, which is sent to the given stream

Parameters

$debug_stream
The stream to output debugging info to
Blesta API documentation generated by ApiGen