PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
How to get the "User-Agent" when sending data with WinHttp.WinHttpRequest?-VBForums
Results 1 to 16 of 16

Thread: How to get the "User-Agent" when sending data with WinHttp.WinHttpRequest?

Threaded View

  1. #1

    Thread Starter
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009

    How to get the "User-Agent" when sending data with WinHttp.WinHttpRequest?

    I'm sending data to a server and need also to pass the User-Agent that identifies the windows version (I don't care about the browser version).

    I now have a static value for the "user-agent". Do you know how to get it from example a webbrowser or is there another way?

    My current code:

        Dim winHttpReq As Object
        Dim myURL As String
        Dim postData As String
        Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
        myURL = ""
        postData = "my_data_for_sending"
        winHttpReq.Open "POST", myURL, False
        winHttpReq.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
        winHttpReq.send (postData)
    How can I get the "User-Agent" from users machine to use it in SetRequestHeader?

    The company (google) says that we can't create some custom User-Agents but we need to use the ones that are already in circulation, because it could break something and the sever will stop accepting our data.

    Last edited by Davor Geci; Oct 14th, 2019 at 01:55 AM.
    My projects:
    Virtual Forms
    VBA Telemetry

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width