How do you get the response as a string using the http_url_get method in rpg

485 Views Asked by At

Good day, I am trying to consume a get method on a server hosted locally.

 rc = http_url_get('http://sss:13013/cgi-bi/sendms?'
                        + 'username=cous&pas'
                        + 'to=' + vCell + '&text=' + %TRIM(vSMSText):
                        '/tmp/httptest.html');

I am using a library called HTTPAPI its from https://www.scottklement.com/httpapi/ I am trying to figure out how to get the response of the call as a string.

The Variable rc contains a integer response code but no response, I am assuming it gets downloaded to the /tmp/httptest.html parameter specified. But I want it as a string as I want to process the response as a string. I do not know if there is a extra parameter that I can use to store the result of the call.

I have tried the http_string method but I get an error that the method is undefined, I think the my client is using an old version of the HTTPAPI lib.

Is it possible to use the http_url_get function to return the response as a string?.

1

There are 1 best solutions below

0
Jorge Ubeda On

if you want to get a string response, use Klement's HTTP_req(). It is flexible enough to get a file or a string (and use a file or a string to send a request). You can play with *omit to select the way you can make a GET (on other actions).