SJH22


So, Ive got a dilema and maybe some of you can help me. Im using ServerXMLHTTP as an object to download about 500,000 web pages and I need to figure out how to run multiple instances of XMLHTTP.

For simplicity sake, this is what I have right now:

objXMLGET = CREATEOBJECT('MSXML2.serverXMLHTTP')

FOR x = 1 TO 500000

ThePage = "http://webpage id=" + STR(x)
objXMLGET.Open ("GET", ThePage , "False")
objXMLGET.Send
sResults = objXMLGET.ResponseBody

** parse routine here **

NEXT x

The problem is that I have so many web pages to go thru, it will take days to accomplish this. Is there anyway I can change the async to True and run more than one instance of the XMLHTTP

Thanks in advance,

SJH




Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

chanmy8


Hi,
Please check this if these links help.

http://blogs.msdn.com/calvin_hsia/archive/2006/05/11/595562.aspx
http://blogs.msdn.com/calvin_hsia/archive/2006/05/16/599108.aspx
http://blogs.msdn.com/calvin_hsia/archive/2006/05/23/605465.aspx
http://www.craigbailey.net/articles/VFPBusinessSkills/index.htm page=_1R517NQ76.htm





Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

SJH22

Thanks for then info...unfortunately I did specify that I was using FoxPro 7 and these programs appear to be using the command 'TRY' which didnt get developed until VFP 8. Im currently using 7 exclusively and would really hate to retrofit all my programs so If anyone here know of a multi-threading example using 7, I would greatly appreciate it.

Thx,

S






Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

SC_A9

One thing you might want to do is cut your application to minimal "get" functionality, and create it as a seperate executable, which writes its output to a (locally shared) table. Then you can let the OS worry about threading/multitasking. Your error handling task might be a little easier as well, since any serious problem with fetching data would be limited to a single mini-exe instance.





Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

AndyKr

>>these programs appear to be using the command 'TRY' which didnt get developed until VFP 8.

PMFJI but TRY...CATCH...ENTRY is merely an error handler (more accurately, an Exception handler). You could re-write Calvin's code without using it and simply handle errors directly. The code between the TRY and the CATCH statements is what matters.







Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

Claude Fox

Check out http://www.codeplex.com/mtmyvfp - I rewrote all the "vfp 9 only" routines to work with VFP 7,8, and 9 ...




Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

Claude Fox

Also, unless you're actually using the XML features, you might want to just use WinHTTPRequest instead for more efficient processing. ServerXMLHTTP is based on this object.




Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

CChalom

Hi Claude,

I've been using your MultiThread classes for 6 months, with great success. They really offer a great possiblility, and easy to implement.

Thanks very much !

Cesar





Re: How to 'multithread' ServerXMLHTTP in FoxPro 7?

Claude Fox

Great! The real thanks goes to Calvin Hsia. IMO, this is the best addition to VFP in quite a while. I just tried to make it easier for everyone to use with my examples on Codeplex.