×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how to open POST request in a browser using vbscript

how to open POST request in a browser using vbscript

how to open POST request in a browser using vbscript

(OP)
I need to open a POST request in a browser using vbscript.

I can open the browser using GET request by the following commands

Set objWShell = CreateObject("WScript.Shell")
objWShell.Run AddQuotes(url)
But I don't know how to do this for POST request. I have tried the following script, but it do the task silently. It doesn't open the browser.

Set xHttp = CreateObject("MSXML2.XMLHTTP")
xHttp.open "POST", "http://www.example.com/", False
xHttp.send paramList
Can anyone help me here.

Thanks
Senthil

RE: how to open POST request in a browser using vbscript

Quote:

It doesn't open the browser.

It won't, it ONLY requests the content from that URL and stores in the .responseXML property.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: how to open POST request in a browser using vbscript

(OP)
ok, I have written my POST request into a html file and called that html file from the vbscript.
In this way, it is working.

But here, the file is accessible to everyone. I want to delete the file after the browser is opened.
I have used the following script.

objWShell.run fileString
subSleep(120)
If objFS.FileExists (fileString) Then
objFS.DeleteFile (fileString)

But within 2 seconds, if someone access the file, it is a security issue. If we remove the sleep the browser is not opening.
The command "objWShell.run fileString, 1, true" is working except for the case, the popup blocker is on.

So, Is there any way to allow the popup blocker for the specified website alone using vbscript?

Thanks
Senthil

RE: how to open POST request in a browser using vbscript

Quote:

So, Is there any way to allow the popup blocker for the specified website alone using vbscript?

Nope, for obvious reasons such controls are ONLY accessible by the user.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: how to open POST request in a browser using vbscript

(OP)
ok, Is there any way atleast to check whether the Popup blocker is enabled or not using vbscript

Thanks
Senthil

RE: how to open POST request in a browser using vbscript

Only if you want to get into some vbscript registry hacking. (Assuming that every user is on MS Windows and using Infernet Exploder and you can 'plant' the script on their machine)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: how to open POST request in a browser using vbscript

Something like the following might help:

CODE

    Set xHTTP = CreateObject("MSXML2.XMLHTTP")
    xHTTP.Open "POST", "http://www.example.com/", False
    xHTTP.send ParamList
    
    Set myIE = CreateObject("InternetExplorer.Application")
    myIE.Visible = 1
    myIE.Navigate "about:blank" ' make sure we have a page
    myIE.Document.body.outerhtml = xHTTP.responseText 

RE: how to open POST request in a browser using vbscript

(OP)
Thanks for the script. I tried the same with my code.
But, this is not working when I have the post parameters in the following format

ParamList = """lang=en&adLocation=CN=hello767 hello767,OU=chennai,OU=India,DC=India-Telecom,DC=com&givenname=hello767"""

Set xHTTP = CreateObject("MSXML2.XMLHTTP")
xHTTP.Open "POST", "http://www.example.com/", False
xHTTP.send ParamList

Set myIE = CreateObject("InternetExplorer.Application")
myIE.Visible = 1
myIE.Navigate "about:blank" ' make sure we have a page
myIE.Document.body.outerhtml = xHTTP.responseText

I am not getting the post parameters.

RE: how to open POST request in a browser using vbscript

Try adding

CODE

xHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
xHTTP.setRequestHeader "Content-length", Len(ParamList) 

before the .Send line

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close