\FAA\Obj\SysCurl

Summary

Methods
Properties
Constants
__construct()
Body()
AddHeaders()
SetDebug()
SetCertificate()
SetBasicAuth()
Download()
Upload()
Send()
No public properties found
No constants found
No protected methods found
$host
$url
$method
$debug
N/A
exec()
init()
$ch
$header
$body
N/A

Properties

$host

$host :

Type

$url

$url :

Type

$method

$method :

Type

$debug

$debug :

Type

$ch

$ch :

Type

$header

$header :

Type

$body

$body :

Type

Methods

__construct()

__construct(string  $method = 'GET',string  $host = null,string  $url = null)

Curl constructor.

Parameters

string $method

The request method

string $host

The full hostname with port and protocol

string $url

The relative url to call

Body()

Body(): null|string

Expose the sent body

Returns

null|string

AddHeaders()

AddHeaders(array  $headers)

Set custom header to the request

Parameters

array $headers

List of headers

SetDebug()

SetDebug(  $val)

Parameters

$val

SetCertificate()

SetCertificate(string  $cert,string  $password = '',string  $ca_cert = '')

Set certificate Set the request certificate file for authentication.

Parameters

string $cert

Absolute path to target certificate. Must be combined .pem

string $password

The certificate password when defined

string $ca_cert

The ca root certificate when defined

SetBasicAuth()

SetBasicAuth(  $username,  $password)

Set http basic auth credentials

Parameters

$username
$password

Download()

Download(string  $file_path): \FAA\Obj\Result

Download a file to path

Parameters

string $file_path

Absolute path to target file (must be writable)

Returns

\FAA\Obj\Result —

A system result object

Upload()

Upload(string  $file_path): \FAA\Obj\Result

Upload the given file

Does an file put/post request depending set method and loads the file to the target

Parameters

string $file_path

Absolute path to target file (must be readable)

Returns

\FAA\Obj\Result —

A system result object

Send()

Send(null|object  $obj = null,boolean  $json = true): \FAA\Obj\Result

Submit call

Send the request to the remote endpoint

Parameters

null|object $obj

The Request payload

boolean $json

When true, send as json

Returns

\FAA\Obj\Result —

A system result object The regular values will contain the response body, when json than parsed The secondary values may contain the http response code

exec()

exec()

init()

init()