Solved

Post vs. Get Tricky Problem

Posted on 2006-11-03
4
200 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
Comment Utility
can you post your code?
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

12 Experts available now in Live!

Get 1:1 Help Now