PxPlus User Forum

Main Board => Discussions => Web Services => Topic started by: Mark Brown on January 27, 2023, 09:54:09 AM

Title: *plus/web/request with Proxy server
Post by: Mark Brown on January 27, 2023, 09:54:09 AM
Are there any plans to enhance *plus/web/request to work with a proxy server that requires a PEM file, username and password?

It would act similar to this curl command with JSON data:
curl <destination url> --cacert <filepath of PEM file> -x https://<username>:<password>@<proxy server url> -H "Content-Type: application/json" -d "<json data>"

Thanks
Mark Brown
Title: Re: *plus/web/request with Proxy server
Post by: Bruno Biancucci on January 27, 2023, 11:45:51 AM
I'm by no means an expert on the matter, but I do use request program all the time.  For the most part in stock form, it does a good job.  You can open this program and adjust it or a copy.  I had a case where I had to pull images from a remote site and request didn't quite work right with the expected payload, so I made a very small adjustment to the code and it's been flawless.  In another case, I wanted more details like timing and raw data being sent/received, so I added a log file; which turned out to be very help full.
I'm not sure about proxy details, but if this information needs to be included in the HTTP header, check out the "extrahdrs$" field.  I have to use this from time to time if certain credentials need to be passed to the server.
Title: Re: *plus/web/request with Proxy server
Post by: Mike King on January 27, 2023, 01:33:13 PM
For Windows you can often simply replace the call to *plus/web/request with a call to *wininet. 
The calling parameters a basically the same:

   url$, postdata$, response$, header$, mimetype$, extraheaders$

It will use the Windows proxy settings.