• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

Post vs. Get Tricky Problem

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
mrferrari
Asked:
mrferrari
  • 2
1 Solution
 
yeroketCommented:
can you post your code?
0
 
GaryCommented:
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
 
Dany BalianCTOCommented:
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
 
Dany BalianCTOCommented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now