Skip to contents

Does the input contain an existing (active) URL?

Usage

isExistingUrl(x)

isAnExistingUrl(x)

allAreExistingUrls(x)

Arguments

x

Object.

Value

TRUE on success; FALSE on failure, with cause set.

Details

Supports HTTPS, HTTP, and FTP protocols.

Functions

  • isExistingUrl(): Vectorized.

  • isAnExistingUrl(): Scalar. Requires a single URL.

  • allAreExistingUrls(): Scalar. Checks that all strings are existing URLs.

Note

Updated 2023-10-02.

See also

  • curlGetHeaders(): Amazing function with good timeout control.

  • open.connection(): Base method with no dependencies, but prone to hang with poor timeout control.

  • RCurl::url.exists(): Seems to be good but adds external dependency.

  • urlchecker and curl packages.

  • https://github.com/r-lib/urlchecker/blob/main/inst/tools/urltools.R

  • https://stackoverflow.com/questions/52911812

  • https://stackoverflow.com/a/17620732/3911732

Examples

## TRUE ====
isAnExistingUrl("https://acidgenomics.com/")
#> [1] TRUE

## FALSE ====
isAnExistingUrl("https://failwhale.acidgenomics.com/")
#> [1] FALSE