url_accessible: Test if a URL is accessible

View source: R/io.R

url_accessibleR Documentation

Test if a URL is accessible

Description

Try to send a HEAD request to a URL using curlGetHeaders() or the curl package, and see if it returns a successful status code.

Usage

url_accessible(x, use_curl = !capabilities("libcurl"), ...)

Arguments

x

A URL as a character string.

use_curl

Whether to use the curl package or the curlGetHeaders() function in base R to send the request to the URL. By default, curl will be used when base R does not have the libcurl capability (which should be rare).

...

Arguments to be passed to curlGetHeaders().

Value

TRUE or FALSE.

Examples

xfun::url_accessible("https://yihui.org")

xfun documentation built on Nov. 1, 2024, 1:06 a.m.