\OmaeUrl
Basic remote URLs interaction class
Synopsis
class OmaeUrl
{
- // constants
- const DEFAULT_VERBOSE_LOG_PATH = 'exports/OMAE_VERBOSE_LOG';
- // members
- protected string $url = '';
- protected integer $timeout = 2;
- protected string $errorMessage = '';
- protected integer $errorCode = 0;
- protected integer $httpCode = 0;
- protected array/bool $lastRequestInfo = ;
- protected bool $error = false;
- protected array $postData = ;
- protected string $rawPostData = '';
- protected array $getData = ;
- protected array $cookieData = ;
- protected array $headersData = ;
- protected string $userAgent = '';
- protected array $curlOpts = ;
- protected bool $headersFlag = false;
- protected string $referrer = '';
- protected bool $verboseLogON = false;
- protected string $verboseLogStream = '';
- protected string $verboseLogFilePath = '';
- protected integer $curlVersion = 0;
- // methods
- public void __construct()
- protected void setUrl()
- protected bool checkModCurl()
- public void setHeadersReturn()
- public void setReferrer()
- protected void loadOpts()
- public void dataPost()
- public void dataPostRaw()
- public void dataGet()
- public void dataCookie()
- public void dataHeader()
- protected void flushPostData()
- protected void flushRawPostData()
- protected void flushGetData()
- protected void flushCookieData()
- protected void flushHeadersData()
- public void setOpt()
- public string response()
- public array error()
- public int httpCode()
- public array/bool lastRequestInfo()
- public void setUserAgent()
- public void setTimeout()
- public void setBasicAuth()
- public void setVerboseLog()
Constants
Name | Value |
---|---|
DEFAULT_VERBOSE_LOG_PATH | 'exports/OMAE_VERBOSE_LOG' |
Members
protected
- $curlOpts
—
array
Contains current instance curl options array as option=>value - $curlVersion
—
int
Contains CURL version as a 3-digits integer - $error
—
bool
Is error happens flag - $errorCode
—
int
Last curl error code - $errorMessage
—
string
Last curl error description - $getData
—
array
Contains get data that will be mixed into URL on requests - $headersData
—
array
Contains current instance headers as headername=>value - $headersFlag
—
bool
Get headers flag - $httpCode
—
int
Contains last request http code - $lastRequestInfo
—
array/bool
Contains last request curl info array or false on error - $postData
—
array
Contains post data array that will be pushed to remote URL - $rawPostData
—
string
Contains RAW-post data just as text - $referrer
—
string
Request referrer - $timeout
—
int
Contains default connection timeout in seconds - $url
—
string
Contains current instance URL - $userAgent
—
string
Contains default user agent - $verboseLogFilePath
—
string
Placeholder for CURL verbose log file - $verboseLogON
—
bool
Enable CURL verbose logging - $verboseLogStream
—
string
Placeholder for CURL verbose logging stream
Methods
protected
- checkModCurl() — Checks is curl PHP extension loaded?
- flushCookieData() — Flushes current instance cookieData set
- flushGetData() — Flushes current instance getData set
- flushHeadersData() — Flushes current instance headersData set
- flushPostData() — Flushes current instance postData set
- flushRawPostData() — Flushes current instance rawPostData content
- loadOpts() — Sets default instance curl options
- setUrl() — Sets instance URL
public
- __construct() — Creates new omae wa mou shindeiru instance
- dataCookie() — Puts some data into protected cookieData property for further usage
- dataGet() — Puts some data into protected getData property for further usage
- dataHeader() — Puts some data into protected headersData property for further usage
- dataPost() — Puts some data into protected postData property for further usage
- dataPostRaw() — Puts some data into protected rawPostData property for further usage in POST requests
- error() — Returns current error state as empty or not array
- httpCode() — Returns last request http code. 0 - on fail.
- lastRequestInfo() — Returns last request full info
- response() — Returns some data from remote source URL
- setBasicAuth() — Sets HTTP basic auth params
- setHeadersReturn() — Sets return headers flag
- setOpt() — Sets curl resource option for further usage
- setReferrer() — Sets instance referrer URL
- setTimeout() — Sets instance connection timeout in seconds
- setUserAgent() — Sets user agent for current instance
- setVerboseLog() — $verboseLogON setter