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
|
#
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
|