• PHP reference
  • Core

HTTP

class Core\HTTP

Class HTTP.

Methods

static redirect(string $url, string $additional_output = '', boolean $http_redir = true)

Redirect user in a browser-friendly way.

Parameters

  • string $url
  • string $additional_output
  • boolean $http_redir

static string getClientIP()

Get the client IP address.

Return Value

  • string

static string getCurrentURL()

Get the current page's URL.

Return Value

  • string

static string getScheme()

Get the current URL scheme (returns http:// or https://).

Return Value

  • string

static boolean hasSSL()

Whether current request is a HTTPS request.

Return Value

  • boolean

static string getHost()

Returns fully qualified domain name for current request.

Return Value

  • string

static string getURLPath(boolean $exclude_locale = false, boolean $extended = false)

Get current request URL path to use to create new query string.

Parameters

  • boolean $exclude_locale
  • boolean $extended

Return Value

  • string

static statusCode(integer $code)

Output correct HTTP status header for a specific status code.

Parameters

  • integer $code

static contentType(string $mime)

Output a Content-Type header.

Parameters

  • string $mime

static contentDisposition(string $disposition, string $filename = null)

Output a Content-Disposition header.

Parameters

  • string $disposition
  • string $filename

static boolean canStoreCookie()

Determine if we can/should store a cookie.

Return Value

  • boolean

static defaultHeaders()

Output default headers.

static header(string $key, string $value, boolean $replace = true, integer $http_response_code = null)

Add a custom header value.

Parameters

  • string $key
  • string $value
  • boolean $replace
  • integer $http_response_code