Goto main content

uriparse

Parse an uri and return its components.

URIPARSE

NAME

uriparse - Parse an uri and return its components.

SYNOPSIS

uriparse("uri");

DESCRIPTION

uriparse extract component from a uri.

The followings components are return if available:

  • uri_scheme ("http"/"ftp"/…)
  • hostinfo combined [user[:password]@]host[:port]
  • uri_user name, as in http://user:passwd@host:port/
  • uri_password, as in http://user:passwd@host:port/
  • uri_query Everything after a ? in the path, if present
  • hostname from URI (or from Host: header)
  • port string (integer representation is in "port")
  • uri_path the request path (or "/" if only scheme://host was given)
  • uri_fragment Trailing "#fragment" string, if present
  • uri_port The port number, numeric, valid only if port_str != NULL
  • uri_port_str The port number, numeric, valid only if port_str != NULL
  • uri original uri

The fonction return as associative array.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{stringnify(sort:true,uriparse("http://www.sednove.com"))}}.] return
res={"hostinfo":"www.sednove.com","hostname":"www.sednove.com","uri":"http://www.sednove.com","uri_port":0,"uri_scheme":"http"}.]);

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.