Solved

Post vs. Get Tricky Problem

Posted on 2006-11-03
4
211 Views
Last Modified: 2006-12-08
I am trying to automate the passing of variables into a webpage and then grab the returned page via some getHTMl method.

However, it seems the page I am calling requires the variables to be passed in using the post method, but I only know how to pass the variables using the get method and then grab the results in a string...

does anyone have any suggestions on how to get this to run?

thanks,
Marc
0
Comment
Question by:mrferrari
  • 2
4 Comments
 
LVL 4

Expert Comment

by:yeroket
ID: 17871096
can you post your code?
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 17871124
Are you using XML


url = "http://www.the_site.com
 

    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "POST", url, false
    xmlhttp.send "value=blah&nextvalue=balh"

    status = xmlhttp.status
    if err.number <> 0 or status <> 200 then
        if status = 404 then
            Response.Write "Page does not exist (404)."
        elseif status >= 401 and status < 402 then
            Response.Write "Access denied (401)."
        elseif status >= 500 and status <= 600 then
            Response.Write "500 Internal Server Error on remote site."
        else
            Response.write "Server is down or does not exist."
        end if
    else  
        Response.Write "Server is up and URL is available."  
    end if  
    set xmlhttp = nothing  
0
 
LVL 11

Expert Comment

by:Dany Balian
ID: 17872518
when you use get, the variables will be appended on the url, and u get them from the request.querystring object

when u use post, the variables will be in the request.form object

samples!!
1- Using POST
-----------------------------------------------------------------------------------------
<form name="mypostform" action="mypostpage.asp" action="post">
<input type="text" name="myvariable">
<input type="submit" value="submit">
</form>

page: mypostpage.asp

<%
response.write (request.form("myvariable"))
%>

1- Using GET
-----------------------------------------------------------------------------------------
<form name="mygetform" action="mygetpage.asp" action="get">
<input type="text" name="myvariable">
<input type="submit" value="submit">
</form>

page: mygetpage.asp

<%
response.write (request.querystring("myvariable"))
%>


hope this was clear enough...

Cheers,

Dan
0
 
LVL 11

Expert Comment

by:Dany Balian
ID: 17872521
sorry in the forms... the second action should be method

<form name="mypostform" action="mypostpage.asp" method="post">
<input type="text" name="myvariable">
<input type="submit" value="submit">
</form>



and


<form name="mygetform" action="mygetpage.asp" method="get">
<input type="text" name="myvariable">
<input type="submit" value="submit">
</form>

cheers,

Dan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# onclick function to call another form with parameter 10 54
Classic ASP + JS 4 79
Copy only dates 3 80
IP API - need data... 4 11
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now