2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: fetch
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
2019-10-06 17:56:45 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Fetch the contents from a URL (HTTP GET operation).
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
```> fetch (URL) --user --password --timeout --headers --raw```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
- `URL`: the URL to fetch the contents from
|
|
|
|
- `--user {any}`: the username when authenticating
|
|
|
|
- `--password {any}`: the password when authenticating
|
|
|
|
- `--timeout {int}`: timeout period in seconds
|
2022-02-21 18:26:00 +01:00
|
|
|
- `--headers {any}`: custom headers you want to add
|
2022-02-14 03:22:51 +01:00
|
|
|
- `--raw`: fetch contents as text rather than a table
|
2019-10-06 17:56:45 +02:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Fetch content from url.com
|
2019-10-06 17:56:45 +02:00
|
|
|
```shell
|
2022-02-14 03:22:51 +01:00
|
|
|
> fetch url.com
|
2019-10-06 17:56:45 +02:00
|
|
|
```
|
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Fetch content from url.com, with username and password
|
2019-10-06 17:56:45 +02:00
|
|
|
```shell
|
2022-02-14 03:22:51 +01:00
|
|
|
> fetch -u myuser -p mypass url.com
|
2020-06-23 20:21:47 +02:00
|
|
|
```
|
2022-02-14 03:22:51 +01:00
|
|
|
|
|
|
|
Fetch content from url.com, with custom header
|
|
|
|
```shell
|
|
|
|
> fetch -H [my-header-key my-header-value] url.com
|
|
|
|
```
|