Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Chris Sharp
  Where is Chris Sharp?
 dayton
 Tennessee - United States
 Chris Sharp
 Tags
Subject: RE: Grab off Web
Thread ID: 365528 Message ID: 365557 # Views: 70 # Ratings: 0
Version: Visual FoxPro 9 Category: Windows 7 and VFP
Date: Friday, December 28, 2012 1:53:58 AM         
   


> Hello, I am trying to figure out how to go to lets say a gold website that shows the price of gold and be able to when the form loads it will grab the price and put into a text-box for me.


Hi Chris,
Probably one of the simplist ways is to create a form and add the Microsoft Internet
Transfer ActiveX control that comes with VFP. Just drop the control on a new form.
Rename the control to something that makes sense like oleInet

Next add a command button on your form and in the click event of the command button add code like:
lcURL = "www.marathongriffincomputers.com"
lcPage = THISFORM.oleInet.OpenURL(lcURL)
?lcPage  && Used only for demonstration purposes here.
* --- Or add code to parse out the gold pricing infromation you want.  You can use SUBSTR()
* --- to pull out values to individual memory variables.
* --- The AT()and ATC()functions are also great for determining if a sub-string exists, 
* --- the former having the advantage of being case insensitive and, moreover, 
* --- their return values gives you an exact position of the sub-string.


I added the ?lcPage just so you can see that the contents of the web page link is now in a
string contained in the memvar lcPage.

Using the lcPage now stored in a string value I will leave the rest up to you to provide
the correct parsing to extract the values you need out of the website page for display in
a TextBox or EditBox.

Of course to get the information to be extracted move the code into the form's Init event
once you debug the parsing.

Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com
Home of the Canadian and US download for Chen's VFP C++ Compiler
http://www.marathongriffincomputers.com/VFP-C++-Compiler.html

ENTIRE THREAD

Grab off Web Posted by Chris Sharp @ 12/27/2012 5:42:02 PM
RE: Grab off Web Posted by Russell Hill @ 12/27/2012 8:00:07 PM
RE: Grab off Web Posted by Pete Sass @ 12/28/2012 1:53:58 AM
RE: Grab off Web Posted by David Mustakim @ 12/28/2012 3:45:53 AM
RE: Grab off Web Posted by Usman Safdar @ 12/28/2012 10:54:17 AM
RE: Grab off Web Posted by David Mustakim @ 12/28/2012 11:07:22 AM
RE: Grab off Web Posted by Usman Safdar @ 12/28/2012 6:51:02 PM
RE: Grab off Web Posted by David Mustakim @ 12/29/2012 12:04:29 AM
RE: Grab off Web Posted by Usman Safdar @ 12/29/2012 11:21:02 AM
RE: Grab off Web Posted by David Mustakim @ 12/29/2012 11:29:07 AM