Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Http

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
boolean
$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
string
$url The URL to GET
$params
mixed
$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( mixed $url, array $params = null, mixed $files = null )

Execut a POST request on the given URL

Execut a POST request on the given URL

Parameters

$url
mixed
$params An array of key/value pairs, or a string of the format key=value&...
$params
array
$files A multi-dimensional array of files in the format of [0]=>array("name"=>"Name of file", "file"=>"File path")
$files

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
string
The 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
array
$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
string
$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
integer
$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
integer
$option The CURLOPT_* option to set
$value
string
$value The value to set
$override
boolean
$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
string
$method The request method (e.g. GET, POST, PUT, DELETE, etc.)
$url
string
$url The URL to requets
$params
mixed
$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
resource
$debug_stream The stream to output debugging info to
private
# buildOptions( )

Passes all set options to curl

Passes all set options to curl

See

NetHttp::setOption()

Magic methods summary

Properties summary

private resource $curl
#

The curl connection

The curl connection

private array $headers
#

An array of headers to sent during the request

An array of headers to sent during the request

private string $cookie_file
#

The cookie file to use during the request

The cookie file to use during the request

private integer $response_code
#

The HTTP response code returned from the last request

The HTTP response code returned from the last request

private boolean $verify_ssl
#

True to verify the SSL cert, false otherwise

True to verify the SSL cert, false otherwise

private array $options
#

An array of options to set for this curl connection

An array of options to set for this curl connection

private resource $debug_stream
#

The stream to send debugging info, null to disable debugging

The stream to send debugging info, null to disable debugging

private boolean $persistent_connection
#

True to enable persistent connections, false to reset the connection for each request

True to enable persistent connections, false to reset the connection for each request

Blesta API documentation generated by ApiGen 2.8.0