---
name: "Arch::LiteWeb"
section: "3pm"
platform: "linux"
package: "libarch-perl"
version: "0.5.2-2"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/Arch::LiteWeb"
---

# Arch::LiteWeb(3pm)

simple way to access web pages

## NAME

Arch::LiteWeb - simple way to access web pages

## SYNOPSIS

```
    my $web = Arch::LiteWeb->new;
    my $content = $web->get("http://some.domain:81/some/path");
    die $web->error . " while processing " . $web->request_url
        unless $content;
    my $content_type = $web->response_headers->{content_type};
```

## DESCRIPTION

This class provides a basic and easy to use support for the client-side HTTP. It is supplied in order to avoid dependency on LWP. If such dependency is not a problem, consider to use LWP instead that provides much better support for HTTP and other protocols.

## METHODS

The following class methods are available:

**get**, **post**, **request\_url**, **error**, **error\_with\_url**, **network\_error**, **response\_code**, **response\_codestr**, **response\_error**, **response\_headers**, **response\_content**.

- **get** *url* \[*params* ...\]

  Execute HTTP get of the given *url* and return the html string or undef on network/response error. Use other methods to get the details about the error and the response.

  *params* is key-value hash, the following keys are supported:

  ```
      url_host            - only used if url is none
      url_port            - only used if url is none (80)
      url_path            - only used if url is none
      endl                - default is "\015\012"
      timeout             - default is 20 seconds
      user_agent          - default is "Arch::LiteWeb/0.1"
      nocache             - add a no-cache header
      noredirect          - don't follow redirect responses
      max_redirect_depth  - default is 5
      use_proxy           - default is false
      proxy_url           - proxy url ($http_proxy supported too)
      proxy_host          - only used if proxy_url is none
      proxy_port          - only used if proxy_url is none (80)
  ```

- **post** *url* *input* \[*params*\]

  Not implemented yet.

- **request\_url**

  Actual url of the last issued request or *undef*. If partial redirect responses are enabled, then the result is the last (non-redirect) url.

- **error**

  If the last request resulted in error (i.e. **get**/**post** returned *undef*), then this method returns the error message, otherwise it returns *undef*. This is just a shortcut for **network\_error** \|\| **response\_error**.

- **error\_with\_url**

  Like error, but with "\\nwhile fetching *request\_url*\\n" text appended if non undef.

- **network\_error**

  The network error message for the last request or *undef*.

- **response\_error**

  The response error message for the last request or *undef*.

- **response\_code**

  The last response code (integer) or *undef*.

- **response\_codestr**

  The last response code (string) or *undef*.

- **response\_headers**

  The last response headers (hashref of HTTP headers) or *undef*.

- **response\_content**

  The last response content or *undef*. This is the same thing that the last **get**/**post** returns.

## BUGS

Not intended for use in mission-critical applications.

## AUTHORS

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).

## SEE ALSO

For more information, see LWP, LWP::Simple.
