Pass variable to a web site

cpopham

Junior Contributor
Joined
Feb 18, 2004
Messages
273
I am using a webclient to get info from a web site. The website uses your zipcode in a variable. I want to pass the zip code in a variable to the website and get the page that follows using my webclient. How can I pass the variable to the webpage and then get the webpage that coems up after that? The webpage uses the Post method to send th zipcode. Here is the code that the website uses to pass the zipcode:

Code:
<form name="searchForm" method="post" target="_top" action="/lkn?action=search&rn=none" style="margin-bottom:0; padding:0; border:0; margin:0"> 
                                    <input name="query" type="text" id="searchfield" size="10" maxlength="25"> 
                                    <a href="javascript:submitSearchForm()"><img src="images/general/redesign/images/search.gif" alt="Search." width="44" height="25" align="top" border="0"></a> 
                                </form>

Someone suggested setting a webbrowser to not be visible and then getting a reference to the variable, but I have no idea to do this. So does anyone have any ideas of how to pass the zipcode as a variable to the website and then get the page that follows?

Chester
 
Is the variable passed in the actual URL? If so, you can just use a Net.WebClient to download the result.

eg, to download the result of Googling "hello", I can do this:

Visual Basic:
Dim blah As New Net.WebClient
blah.DownloadFile("http://www.google.com.au/search?hl=en&q=hello", "c:\blah.html")

That works perfectly for many things like this. Then you can use DHTML to rip any information you want out of the resulting HTML file.
 
Back
Top