Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Retrieving Data from query string

  Asked By: Nancy    Date: Nov 29    Category: MS Office    Views: 599
  

Is there a way of getting(retriving) the data send through a browser as query
string(post method) using excel VBA.
Let me be more clear suppose a webpage(say WP1) calls another webpage(say WP2)
and passes some variables as query string(by post method). since the data is not
visible in query string, it is not possible by ordinary means to call the second
webpage(WP2) directly.
I want to get some data from this second webpage directly using excel VBA and
create a chart for it
A few code snippets related to it would be a great help

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Vonda Ramirez     Answered On: Nov 29

Sounds like you are sending data  via a web form. My fist suggestion is
to look at the URL when you manually enter information via the internet
form. Sometimes the ASP page URL appears and you can see where it
searches for your data. Example:
www.webaddress.com//product/product.asp?sku= "your data"

If that is not possible then you need to submit your data via the web
form. To do this you need to set a reference to Microsoft Internet
Controls and create an Internet Explorer Object.

Here is an example of using the object, and sending username and
password data via the form.
Dim IEObj As New InternetExplorer
Dim sURL as String

sURL = "https://Enter Web Address Here"
IEObj.Navigate sURL
Do While IEObj.ReadyState <> READYSTATE_COMPLETE
Loop
IEObj.Document.Forms(0)("username").Value = "Name"
IEObj.Document.Forms(0)("passwd").Value = "Password"
IEObj.Document.Forms(0).Submit

You need to find the name of the user form values and replace the values
seen above. Passing regular data such as stock quotes is basically the
same thing...find the name of the search form field, pass your value and
Submit as shown above.

 
Answer #2    Answered By: Bach-yen Nguyen     Answered On: Nov 29

One technique I use is a bookmarklet that converts the POST methods
into GET methods. In most case, this exposes a useable URL with
viewable query  strings. Or, if you use FireFox, the "Web Developer"
extension has an option to do it.

The bookmarklet is "frmget" here:

http://www.squarefree.com/bookmarklets/forms.html

 
Didn't find what you were looking for? Find more on Retrieving Data from query string Or get search suggestion and latest updates.




Tagged: