Question:
I'm using the VB.Net 4 DLL (9.5.0.54) and when posting to a PHP page set to output the User-Agent, this is always blank.
I have tried using AddHeader on the request (HttpRequest), UserAgent on the HTTP object and SetRequestHeader on the HTTP object all without success.
I have also tried upgrading to the latest version of the DLL and this didn't seem to resolve the issue.
The PHP page is very basic and just reads $_SERVER['HTTP_USER_AGENT'] and outputs it to a file. Using a browser works fine.
Are there any suggestions to get this to work?
Headers such as User-Agent, are only automatically added for HTTP methods that don't have an HttpRequest object argument. For methods such as SynchronousRequest where an HttpRequest object is passed in, the headers are completely specified by the HttpRequest object.
To summarize:
For methods such as QuickGetStr, QuickPutStr, PostJson, etc, where there is no HttpRequest argument, then some default headers are added, and request headers can be added/modified/removed by calling SetRequestHeader and RemoveRequestHeader.
For methods where an HttpRequest argument exists, the headers are specified by the HttpRequest object, and nothing is implicit (except for Content-Length).
I recommend trying the latest version of the library to see if it is a bug that has already been fixed.