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
int
Connection time out, default is 3 seconds.
int
Request time out, default is 5 seconds,
bool
string
User name if page url requires authorization
string
Password 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
string
array
object
null
arrays values and object properties are automatically urlencode()-ed, otherwise you have to do it yourself if you pass a string
string
default self::HTTP_POST it can be HTTP_GET, HTTP_POST or HTTP_DELETE, any other value will be replaced by HTTP_POST; case insensitive
int
the HTTP response code is placed in this parameter
string
boolean
a response string if $pReturnTransfer was true in init(), otherwise true on success or false on errorgetError() : string
string
getErrorCode() : string
string
getErrorMsg() : string
string
getMethod() : string
string
getResponse() : array
array
getUrl() : string
string
httpBuildQuery(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
string
init(int $connectTimeOut, int $requestTimeOut, bool $returnTransfer, string $userName, string $password) : void
int
Connection time out, default is 3 seconds.
int
Request time out, default is 5 seconds,
bool
string
User name if page url requires authorization
string
Password if page url requires authorization
login(string $userName, string $password) : void
If url requires authorization
string
User name if page url requires authorization
string
Password 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
string
One of methods POST, GET, DELETE.
setOption(string $option, mixed $value) : void
string
Option name
mixed
Parameter value
setUrl(string $url) : void
string
Requests 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