The WebRequest() function does not work with url that contain the '?' character

I am using MT5 build 6230. The WebRequest() function does not work with url that contain the '?' character (the Query String / Query Parameters). If I enter the same URL into a web browser, I can retrieve the data, but I am unable to do so using WebRequest(). However, if I use a URL that does not contain the '?' character, the data is retrieved successfully.
Nguyen Van Luong #:
The WebRequest() function does not work with url that contain the '?' character

WebRequest handles query strings fine, I use them every day, so the problem is usually in what goes after the ?. Three things to check:

1. Print GetLastError() and the returned HTTP status code. If you get -1 with 4014, the base address is not in the allowed list. Add only the host there (https://api.example.com), without the path or the query.
2. Encode the values. Spaces, + , / , : and non-Latin characters must be percent-encoded. The browser does that for you silently, WebRequest does not.
3. Send a User-Agent header. Many APIs answer 403 or an empty body when the request has no User-Agent, and that looks exactly like the query being the problem.

If it still fails, post the status code and the URL with the key removed, and we can see which part breaks.