NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

# ns_geturl(n) 4.99.8 naviserver "NaviServer Built-in Commands"

## Name

ns_geturl - Fetch a URL

## Table Of Contents

## Synopsis

- ns_geturl URL ?headersSetIdVar?

## Description

This function retrieves the contents of the passed-in URL. If headersSetIdVar is passed in and it is a valid ns_set, then the header information received along with the request is inserted into it.

Notes: This function should be used with caution. If the server is running with 1 thread, and you perform ns_geturl back to the originating server, the server may deadlock. Also, ns_geturl does not follow redirects or handle relative URLs. URLs that are server-relative (begin with "/") are translated into filenames, and the content of the file is returned.

The functions was deprecated in favor of ns_http.

## COMMANDS

ns_geturl URL ?headersSetIdVar?

## EXAMPLES

    ns_register_proc GET /wais getwais
    proc getwais { } {
      ns_return 200 text/html [ns_geturl http://www.wais.com/]
    }

## See Also

ns_http

## Keywords

http-client