parse_url: Parse and build urls according to RFC1808.

Description Usage Arguments Value Examples

View source: R/url.r

Description

See http://tools.ietf.org/html/rfc1808.html for details of parsing algorithm.

Usage

1
2
3

Arguments

url

For parse_url a character vector (of length 1) to parse into components; for build_url a list of components to turn back into a string.

Value

a list containing:

Examples

1
2
3
4
5
6
7
8
parse_url("http://google.com/")
parse_url("http://google.com:80/")
parse_url("http://google.com:80/?a=1&b=2")

url <- parse_url("http://google.com/")
url$scheme <- "https"
url$query <- list(q = "hello")
build_url(url)

Example output

$scheme
[1] "http"

$hostname
[1] "google.com"

$port
NULL

$path
[1] ""

$query
NULL

$params
NULL

$fragment
NULL

$username
NULL

$password
NULL

attr(,"class")
[1] "url"
$scheme
[1] "http"

$hostname
[1] "google.com"

$port
[1] "80"

$path
[1] ""

$query
NULL

$params
NULL

$fragment
NULL

$username
NULL

$password
NULL

attr(,"class")
[1] "url"
$scheme
[1] "http"

$hostname
[1] "google.com"

$port
[1] "80"

$path
[1] ""

$query
$query$a
[1] "1"

$query$b
[1] "2"


$params
NULL

$fragment
NULL

$username
NULL

$password
NULL

attr(,"class")
[1] "url"
[1] "https://google.com/?q=hello"

httr documentation built on Aug. 20, 2017, 5:06 p.m.