SPHPlayground API
SPHPlayground
sphplayground sphplayground

URL related components

Uniform Resource Locator (URL)

A Uniform Resource Locator (URL) is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. Every HTTP URL conforms to the syntax of a generic URI.[1] The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment. [2]

URI = scheme ":" ["//" authority ] path ["?" query ] ["#" fragment ]
authority = [ userinfo "@"] host [":" port ]
userinfo = user ":" pass

URL component manipulation:

  1. scheme: scheme - e.g. http(s)
    URL::getScheme() | URL::setScheme() | URL::containsScheme()
  2. authority: optional component
    1. userinfo: An optional userinfo subcomponent. Providing user information directly in HTTP URLs is not recommended. Use other methods to avoid for example semantic URL attacks. [3]
      1. user: optional component
        URL::getUsername() | URL::setUsername() | URL::containsUsername()
      2. pass: optional component
        URL::getPassword() | URL::setPassword() | URL::containsPassword()
    2. host: A host subcomponent, consisting of either a registered name (including but not limited to a hostname) or an IP address. [4]
      URL::getHost() | URL::setHost() | URL::containsHost()
    3. port: An optional port subcomponent
      URL::getPort() | URL::setPort() | URL::containsPort()
  3. path: A path component, consisting of a sequence of path segments separated by a slash
    URL::getPath() | URL::setPath() | URL::containsPath()
  4. query: An optional query component impemented by QueryString
  5. fragment: An optional fragment component
    URL::getFragment() | URL::setFragment() | URL::containsFragment()
Synopsis

class URL

Query string

A query string is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML document, choosing the appearance of a page, or jumping to positions in multimedia content. [5]

QueryString parameter manipulation:

Parameters can also be manipulated using ArrayAccess interface

Synopsis

class QueryString