\AlocURL

Object-oriented cURL wrapper

Summary

Methods
Properties
Constants
__construct()
notimeout()
laxSSLMode()
__toString()
init()
escape()
getinfo()
pause()
version()
wasSuccessful()
reset()
unescape()
__destruct()
setopt()
exec()
get()
close()
error()
errno()
setopt_array()
setURL()
__set()
No public properties found
No constants found
No protected methods found
$ch
$exec
$errno
$error
$is_open
N/A
No private methods found
No private properties found
N/A

Properties

$ch

$ch : resource

The cURL resource

Type

resource

$exec

$exec : mixed

Result of exec()

Type

mixed

$errno

$errno : integer

Error number of exec()

Type

integer

$error

$error : string

Error message of exec()

Type

string

$is_open

$is_open : boolean

Whether the connection is open

Type

boolean

Methods

__construct()

__construct(string  $url = null) 

Instantiates the library

Parameters

string $url

Optionally, the URL for curl_init()

Throws

\Alo\Exception\ExtensionException

When the curl extention is not loaded

notimeout()

notimeout(boolean  $enabled = true) : \Alo\cURL

Set whether cURL should time out

Parameters

boolean $enabled

The switch

Returns

\Alo\cURL

laxSSLMode()

laxSSLMode(boolean  $enabled = true) : \Alo\cURL

Toggles lax SSL verification mode which doesn't check certificates

Parameters

boolean $enabled

Whether the mode is enabled or disabled

Returns

\Alo\cURL

__toString()

__toString() : string

Returns a string representation of the object data

Returns

string

init()

init(string  $url = null) : \Alo\cURL

A static wrapper function for __construct()

Parameters

string $url

Optionally, the URL for curl_init()

Returns

\Alo\cURL

escape()

escape(string  $str) : string

URL encodes the given string

Parameters

string $str

The string

Returns

string —

The escaped string

getinfo()

getinfo(integer  $opt) : mixed

Get information regarding a specific transfer

Parameters

integer $opt

One of the cURL constants

Returns

mixed

pause()

pause(integer  $bitmask) : integer

Pause and unpause a connection

Parameters

integer $bitmask

One of CURLPAUSE_* constants.

Returns

integer —

An error code (CURLE_OK for no error).

version()

version(integer  $age = CURLVERSION_NOW) : array

Gets cURL version information

Parameters

integer $age

Returns

array

wasSuccessful()

wasSuccessful() : boolean|integer

Checks whether the last transfer was successful

Returns

boolean|integer —

If successful - true, if not & cURL error code exists

  • cURL error code, false otherwise

reset()

reset() : \Alo\cURL

Reset all options of a libcurl session handle

Returns

\Alo\cURL

unescape()

unescape(string  $str) : string

Decodes the given URL encoded string

Parameters

string $str

Returns

string —

The decoded string

__destruct()

__destruct() 

Auto-cleanup

setopt()

setopt(integer  $name, mixed  $value) : \Alo\cURL

Sets an option

Parameters

integer $name

The option - see cURL constants

mixed $value

The option value

Returns

\Alo\cURL

exec()

exec() : \Alo\cURL

Executes the cURL connection parameters

Returns

\Alo\cURL

get()

get(string  $url = null) : mixed

Gets the results of a cURL exec. If $url is set, will exec on that URL

Parameters

string $url

Optional URL override

Returns

mixed —

The results of exec()

close()

close() : \Alo\cURL

Closes a cURL connection

Returns

\Alo\cURL

error()

error() : string

Returns the error message of the last exec()

Returns

string

errno()

errno() : integer

Returns the error number of the last exec() or 0 if no error occurred

Returns

integer

setopt_array()

setopt_array(array  $a) : \Alo\cURL

Sets an array of options

Parameters

array $a

An array specifying which options to set and their values. The keys should be valid curl_setopt() constants or their integer equivalents.

Returns

\Alo\cURL

setURL()

setURL(string  $url) : \Alo\cURL

Sets the connection URL

Parameters

string $url

The URL

Returns

\Alo\cURL

__set()

__set(string  $name, mixed  $value) 

Wrapper for setopt()

Parameters

string $name

Param name

mixed $value

Param value