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 | Intent | Optional | 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. |
An integer indicating whether the operation was successful (0) or not (non-zero).
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