Windows Vista Forums

Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.5.1
  1. #1


    Travis McGee Guest

    Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.5.1

    I need to create this functionality outside of the IIS with an object - pre
    ..NET code.
    The code below is part of a classic ASP.

    <%
    Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
    objHttp.open "POST", www.Microsoft.com/myPage.asp, False
    WinHttpRequestOption_SslErrorIgnoreFlags = 4
    objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300
    objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
    sReturnedResponse = objHttp.responseText
    %>

    So you just cannot do an OLE call ==>
    CreateObject("WinHTTP.WinHTTPRequest.5.1") , becuase this object is part of
    the IIS server and is isolated, I think.

    Does anybody know an Object that is part of the Win 2003 or 2008 (already
    installed) but can be called with CreateObject("xxxxx").



    Example: MSXML does not work, because you cannot POST the Named pairs
    seperately, it has to be part of the URL. And perhaps there is no way of
    setting flags like the SslErrorIgnoreFlag
    Set XMLHTTP = CreateObject("Msxml2.XMLHTTP")
    XMLHTTP.Open "POST", sUrl & "?" & sPairs, False
    x = XMLHTTP.send()

    Anything will help



      My System SpecsSystem Spec

  2. #2


    Old Pedant Guest

    RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.

    Just using MSXML2 wrong.
    <%
    Set objHttp = Server.CreateObject("msxml2.ServerXMLHTTP")
    objHttp.open "POST", "www.Microsoft.com/myPage.asp", False
    objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
    sReturnedResponse = objHttp.responseText
    %>

    Caution: Some servers won't accept the POST from non-browser requestors.
    (Ran into that a while back.)

      My System SpecsSystem Spec

  3. #3


    Old Pedant Guest

    RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.

    Ugh...just tried my answer on a couple of different sites with no luck.

    But others have done this quite successfully. Just answered a post the
    other day where a guy did this to hit a credit card processing site.

    Double ugh.


      My System SpecsSystem Spec

  4. #4


    Old Pedant Guest

    RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.

    Got it!

    Forgot about needing to set the Content-Type header value.

    Here, you can try it:

    Set http = CreateObject("msxml2.ServerXMLHTTP")
    http.Open "POST", "http://www.clearviewdesign.com/silly.asp", False
    http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    http.Send "id=7&name=barney"
    WScript.Echo "Received: " & http.ResponseText



      My System SpecsSystem Spec

  5. #5


    Anthony Jones Guest

    Re: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.5.1

    "Travis McGee" <travisGatesMcGee@xxxxxx> wrote in message
    news:OFIHIEt4IHA.996@xxxxxx

    > I need to create this functionality outside of the IIS with an object -
    pre

    > .NET code.
    > The code below is part of a classic ASP.
    >
    > <%
    > Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
    > objHttp.open "POST", www.Microsoft.com/myPage.asp, False
    > WinHttpRequestOption_SslErrorIgnoreFlags = 4
    > objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300
    > objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
    > sReturnedResponse = objHttp.responseText
    > %>
    >
    > So you just cannot do an OLE call ==>
    > CreateObject("WinHTTP.WinHTTPRequest.5.1") , becuase this object is part
    of

    > the IIS server and is isolated, I think.
    >
    WinHTTP is pretty ubiquitous these days and is available on all windows
    platforms in current support.

    > Does anybody know an Object that is part of the Win 2003 or 2008 (already
    > installed) but can be called with CreateObject("xxxxx").
    >
    > Example: MSXML does not work, because you cannot POST the Named pairs
    > seperately, it has to be part of the URL. And perhaps there is no way of
    > setting flags like the SslErrorIgnoreFlag
    > Set XMLHTTP = CreateObject("Msxml2.XMLHTTP")
    > XMLHTTP.Open "POST", sUrl & "?" & sPairs, False
    > x = XMLHTTP.send()
    >
    > Anything will help
    >
    I'm not sure understand your comment about named pairs, its quite common to
    use XMLHTTP to emulate a standard HTML Form post which use this sort of
    pairing.

    However since you need to fiddle with some other request options you can use
    WinHTTP. You'll have a problem if the clients are Win95/98 though.


    --
    Anthony Jones - MVP ASP/ASP.NET



      My System SpecsSystem Spec

Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.5.1 problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
WinHTTP Web Proxy Auto-Discovery Service Patrick D. Server General 2 09 Feb 2010
Getting weird error about winhttp.dll Polydeuces Live Messenger 1 08 Apr 2008
measure-object works interactively but not in script Frank PowerShell 1 26 Feb 2007
RPCping works, Outlook RPC over HTTP not, why ? Simone Chemelli Vista networking & sharing 2 08 Dec 2006
Adding canonical aliases for Compare-Object, Measure-Object, New-Object Alex K. Angelopoulos [MVP] PowerShell 2 26 May 2006