| category | OSS |
|---|---|
| package | OSS_Countries |
| copyright | Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland |
| license | New BSD License |
__construct(int $connectTimeOut, int $requestTimeOut, bool $returnTransfer, string $userName, string $password) : void
intConnection time out, default is 3 seconds.
intRequest time out, default is 5 seconds,
bool
stringUser name if page url requires authorization
stringPassword if page url requires authorization
close() : void
execute(string $pUrl, string | array | object | null $pData, string $pMethod, int $pResponseCode) : string | boolean
If $pData is not empty in a GET request, then it will be appended to the URL. In this case arrays are passed through http_build_query() first (so the values are urlencode()-ed), strings just simply appended to the URL. Append means the function will add the leading '?', too.
string
stringarrayobjectnullarrays values and object properties are automatically urlencode()-ed, otherwise you have to do it yourself if you pass a string
stringdefault self::HTTP_POST it can be HTTP_GET, HTTP_POST or HTTP_DELETE, any other value will be replaced by HTTP_POST; case insensitive
intthe HTTP response code is placed in this parameter
stringbooleana response string if $pReturnTransfer was true in init(), otherwise true on success or false on errorgetError() : string
stringgetErrorCode() : string
stringgetErrorMsg() : string
stringgetMethod() : string
stringgetResponse() : array
arraygetUrl() : string
stringhttpBuildQuery(array $pArray, $pMode) : string
..) in an RFC 1738 or 3986 format. It does what http_build_query() does, but http_build_query() only supports the older RFC 1738 format. New versions of PHP will support RFC 3986 natively, probably as of version 5.3.6 and 5.2.11. Check the online PHP documentation and your PHP version. By default this method is also using http_build_query() in RFC 1738 mode.
array
stringinit(int $connectTimeOut, int $requestTimeOut, bool $returnTransfer, string $userName, string $password) : void
intConnection time out, default is 3 seconds.
intRequest time out, default is 5 seconds,
bool
stringUser name if page url requires authorization
stringPassword if page url requires authorization
login(string $userName, string $password) : void
If url requires authorization
stringUser name if page url requires authorization
stringPassword if page url requires authorization
setData(array $data) : void
Please note that it overwrites (extends with data) the URL in GET requests.
array
setMethod(string $method) : void
stringOne of methods POST, GET, DELETE.
setOption(string $option, mixed $value) : void
stringOption name
mixedParameter value
setUrl(string $url) : void
stringRequests URL
$_curlHandler : resource
We need a global variable to store the handle between cURL operations, so we can use persistent connections.
$_method : string
$_response : array
$_url : string
HTTP_DELETE
HTTP_GET
HTTP_POST
RFC_1738
RFC_3986