##
# \donttest{
host(
ipv4(
c("127.0.0.1")
)
)
##
h <- host(c(
"icann.org", "iana.org"
))
##
host(ipv4(h))
##
## Domain names internationalization
##
##
## results may vary according to the (POSIX) platform
host(c("bucher.de", "Bücher.de"))
# }
##
if( ip.capabilities()["IDN"] ){
##
dn <- c(
enc2utf8("bücher.de") ## ensure UTF-8
## cannot input emoji with Latex
, "\U1f4a9" # or alternatively: rawToChar(as.raw(c(0xf0, 0x9f, 0x92, 0xa9, 0x2e, 0x6c, 0x61)))
)
##
Encoding(dn) <- "UTF-8"
##
dn
## enforce internationalization with different options
flags <-rep( c( "IDNA_DEFAULT" , "IDNA_ALLOW_UNASSIGNED"), each = length(dn))
##
dni <- toIdna( dn, flags)
## convert back
fromIdna(dni, flags)
# \donttest{
##
host(dni)
# }
}
##
# \donttest{
##
## French country-code top-level domains (ccTLD)
##
tld <- whois(
c(
"fr", "re", "tf", "wf", "pm", "yt"
, "nc", "mq"##, "gp", "gf"
, "pf"
)
, verbose = 1 ## be a little verbose
, output = 1 ## output key-value pairs
)
##
sapply(tld, function(x) x[names(x)=="whois"])
##
## R related info
##
rhost <- host('r-project.org')
## hostname : "cran.wu-wien.ac.at"
rhost.hnm <- host.info(ipv4(rhost))
## primary domain : "ac.at"
fqdn(rhost.hnm)
## ARIN
ipv4.rir()[ip.match(ipv4(rhost), ipv4.rir())]
##
ip.match(ipv4(rhost), ipv4.recovered())
## domain name info
rdom.wh <- whois('r-project.org', output=1)
## "AT"
rdom.wh[['r-project.org']]['Registrant Country']
## host
rhost.wh0 <- whois(ipv4(rhost),verbose = 2, output=1)
# }
Run the code above in your browser using DataLab