pclib  2.9.5
Lightweight PHP framework
Public Member Functions
Request Class Reference

Provides unified access to HTTP request. More...

Inheritance diagram for Request:
BaseObject

Public Member Functions

 getMethod ()
 Return request method. More...
 
 isAjax ()
 Is current request AJAX request?
 
 isSSL ()
 We have HTTPS?
 
 getHost ()
 Return http host.
 
 getPort ()
 Return request port.
 
 getUrl ()
 Return current url.
 
 getRootUrl ()
 Return root Url.
 
 getClientIp ()
 Return client IP address. More...
 
 getServerIp ()
 Return server IP address (safe).
 
 getBaseUrl ()
 Return base Url.
 
 getWebRoot ()
 Return document root.
 
 getHeaders ()
 Return request headers array. More...
 
 getRawBody ()
 Return request body.
 
 urlMatch ($pattern)
 Match current url against pattern. More...
 
 getUserAgent ()
 It will try detect user agent, version and OS. More...
 
- Public Member Functions inherited from BaseObject
 loadDefaults ($className=null)
 Load default parameters of class $className into object instance.
 
 setProperties (array $defaults)
 Set public properties of object from the array. More...
 
 toArray ()
 Convert object to array. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseObject
static defaults ()
 Set or retireve default parameters of the object. More...
 
- Data Fields inherited from BaseObject
 $serviceLocator
 var function() Return service object when requested with service().
 
- Protected Member Functions inherited from BaseObject
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 

Detailed Description

Provides unified access to HTTP request.

Can detect request method, url, user agent, request headers and such. For any getXxx() method, you can use shortcut ->xxx - e.g. print $app->request->url;

Member Function Documentation

◆ getClientIp()

getClientIp ( )

Return client IP address.

Warning: Can be faked!

◆ getHeaders()

getHeaders ( )

Return request headers array.

Returns
array headers [name => content] pairs

◆ getMethod()

getMethod ( )

Return request method.

'POST','GET' etc.

◆ getUserAgent()

getUserAgent ( )

It will try detect user agent, version and OS.

Returns
array [$os,$agent,$version]

◆ urlMatch()

urlMatch (   $pattern)

Match current url against pattern.

Parameters
string$patternfnmatch pattern Example: 'http://localhost/*'

The documentation for this class was generated from the following file: