In order to read the output returned by a web server as a result of an HTTP request you need to use an HTTP component. There are dozens such components, which will allow you to send and receive data via HTTP, including the
Internet Transfer Control, which comes with Visual Basic.
The following code uses the Internet Transfer Control to retrieve the content of
http://www.foxweb.com into a variable and then returns the HTML source to the browser:
<% oInet = CREATEOBJECT("InetCtls.Inet") oInet.Protocol = 4 && Set protocol to HTTP oInet.RequestTimeout = 120 HTMLData = oInet.OpenUrl("http://www.foxweb.com") Response.Write('<pre>' + Server.HTMLEncode(M.HTMLData) + '</pre>') %> |
FoxWeb Support Team support@foxweb.com email |
Sent by John Faithfull on 04/07/2003 06:15:56 AM:
Hello,
As I know a lot about Foxpro, but little about PHP or PERL, I'd like to be able to do this in Foxpro/Foxweb if possible, rather than blunder about with new languages.
Can you suggest a way of reading the contents of a Web page into a Foxpro character string? Sort of like a filetostr() for urls...
I want to combine data from several web pages and redisplay them as a single page. The idea is to be able to provide a single form which will search and return results from several unrelated CGI-based databases in a single page. Copyright is not an issue, but there are no resources to tweak the functionality of the various search sites, so I need to be able to do all the tweaking either client-side, or on my Foxweb server.
If I can read each results page into a separate character variable, the rest of the manipulation should be easy.
Any suggestions?
John Faithfull
Hunterian Museum
University of GLasgow