Solved

Post vs. Get Tricky Problem

Posted on 2006-11-03
4
232 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change visitor's REMOTE_ADDR to server's REMOTE_ADDR 2 47
Index on a Table 6 31
Hide Table in merge 3 42
JQuery Autocomplete Tag AJAX (Need nice script) 11 57
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 informatio…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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