locked
VBScript - IE.Navigate does not POST RRS feed

  • Question

  • Does anyone know how to make the IE.Navigate function in VBScript do a POST instead of a GET?  I have written a script that is supposed to automate the opening of an Internet Explorer window and navigate to a servlet's doPost method.  Eventually this script will interface with a non-browser application that will pass in the parameter(s), but for now I am just setting the parameter(s) in the script itself.  The code below is exactly the same as what I have seen in numerous examples on the Internet on how to POST to a servlet, but it just doesn't work.  It always ends up in the doGet.  According to the documentation for the IE.Navigate function, if you have a value where vPOST is, it should be treated as a POST.  Am I doing something wrong or is there something wrong with the IE.Navigate function?  The only way I have been successful in reaching doPost is to use the xmlHttp object, of course this doesn't render the Internet Explorer window.  If I could somehow use the xmlHttp object in conjunction with the Internet Explorer object that would probably be OK, but I would prefer to just use the IE.Navigate method.  If it matters, I am using IE 7 but I would like for the solution to work with other versions of IE.  Please help!  Thank you.

    <job id = "iedp">
    <script language="VBScript">
    Dim IE : Set IE = CreateObject("InternetExplorer.Application")

    Dim url, vPOST, vHEADER

    url="http://localhost:9080/AnApplication/ALaunch"
    vHEADER="Content-Type: application/x-www-form-urlencoded"
    vPOST="id=ab12345"

    IE.Visible = True

    IE.Navigate url,,,vPOST,vHEADER
    </script>
    </job>

     

    Monday, April 12, 2010 10:51 PM

All replies

  • Hi

    You have to convert your vPOST to a byte array.

    Regards.


    Rob^_^
    Tuesday, April 13, 2010 10:39 PM
  • Remember to use the code tags for our code. ;)
    Thursday, June 17, 2010 11:33 PM
  • Can anyone help me to convert vPOST to a byte array in vbscript?

    I need to write a vbscript that logs into a web site that accepts username and password only with POST method.

    I understand that vPOST must be a byte array, but I am not able to build it.

    Thank you all for your help

    Simona

     

     

    Monday, April 11, 2011 12:04 PM