Open topic with navigation

# send

The `send` method sends the HTTP request.

## Syntax

    send()

## Returns

(LuaHttpResponse). A LuaHttpResponse object.

The `send` method can throw an exception if the request fails. You can catch an exception by calling the method using the Lua function `pcall`.

## Example

The following example shows how to send a request:

    local config_string = [===[
    [HTTP]
    ProxyHost=proxy
    ProxyPort=8080
    SSLMethod=NEGOTIATE
    ]===]

    local config = LuaConfig:new(config_string)
    local request = LuaHttpRequest:new(config, "HTTP")
    request:set_url("https://www.example.com")
    request:set_method("GET")

    local result, response = pcall(LuaHttpRequest.send, request)

    if (result) then
        print ("Success: " , response:get_http_code())
    else
        print ("Error: " , response)
    end

When the `send` method is successful, the `result` variable is `true` and `response` is a LuaHttpResponse object. If an exception is thrown from the `send` method, the `result` variable is `false` and `response` contains the error message.

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm