set_postfields Function

private function set_postfields(curl_ptr, data) result(status)

Set the data to be sent in the HTTP POST request body.


Use as helper function by set_body procedure to set request body

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(inout) :: curl_ptr

Pointer to the CURL handle.

character(len=*), intent(in), target :: data

The data to be sent in the request body.

Return Value integer

An integer indicating whether the operation was successful (0) or not (non-zero).


Contents

Source Code


Source Code

    function set_postfields(curl_ptr, data) result(status)
        !!> Set the data to be sent in the HTTP POST request body.
        !!____
        !!> Use as helper function by `set_body` procedure to set request body
        type(c_ptr), intent(inout) :: curl_ptr
            !! Pointer to the CURL handle.
        character(*), intent(in), target :: data
            !! The data to be sent in the request body.
        integer :: status
            !! An integer indicating whether the operation was successful (0) or not (non-zero).

        status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDS, c_loc(data))
        status = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDSIZE_LARGE, len(data, kind=int64))

    end function set_postfields