Discussion:
newbie question, How can i make HTTP post and get connection in Visual FoxPro?
(too old to reply)
Ziong
2004-08-25 07:03:28 UTC
Permalink
Hi all,
i'm a newbie in visual foxpro. I would like to make a HTTP post and get
connection in VFP, how can i do that?
where can i get references/document/sample code? i found a Class by
west-wind, did anyone try that? is it ok?

thx a lot
Olaf Doschke
2004-08-25 09:29:49 UTC
Permalink
Post by Ziong
i'm a newbie in visual foxpro. I would like to make a HTTP post and get
connection in VFP, how can i do that?
where can i get references/document/sample code? i found a Class by
west-wind, did anyone try that? is it ok?
West Wind is one leading producer
of foxpro products related to internet.

So yes, it's a good starter, as you
probably will stay with that...

Do you want to retrieve a webpage?
For that simple task you could als
use the winsock or some dll like
urlmon.dll:

lcWebpage="http://www.google.com/index.html"
lcLocalfile="d:\test\google.html"

DECLARE INTEGER URLDownloadToFile IN urlmon.dll;
INTEGER pCaller, STRING szURL, STRING szFileName,;
INTEGER dwReserved, INTEGER lpfnCB
= URLDownloadToFile (0, lcWebimage, lcLocalimage, 0, 0)

WAIT WINDOW "saved "+lcLocalfile timeout 1

Bye, Olaf.
Olaf Doschke
2004-08-25 09:34:33 UTC
Permalink
Post by Olaf Doschke
= URLDownloadToFile (0, lcWebimage, lcLocalimage, 0, 0)
Sorry, that line should be
= URLDownloadToFile (0, lcWebpage, lcLocalfile, 0, 0)
here.. loading other files, like images is also possible of course...

Bye, Olaf.
Ziong
2004-08-25 09:53:13 UTC
Permalink
Thx Olaf!
i'll study west wind's one, since i need to do post action.
thx once more.
Post by Olaf Doschke
Post by Olaf Doschke
= URLDownloadToFile (0, lcWebimage, lcLocalimage, 0, 0)
Sorry, that line should be
= URLDownloadToFile (0, lcWebpage, lcLocalfile, 0, 0)
here.. loading other files, like images is also possible of course...
Bye, Olaf.
Rick Strahl [MVP]
2004-08-27 05:26:20 UTC
Permalink
Hi Ziong,

Not much need to study <g>...

The code do this looks like this:

oHttp = CREATE("wwHTTP")

* oHTTP.nPostMode = 2 && 2 - multipart-form 4 - XML 0 - default Urlencoded

oHTTP.AddPostKey("txtSearch",lcValue)
lcHtml = oHTTP.HttpGet("http://www.west-wind.com/search.asp")

http://www.west-wind.com/wwIPstuff.asp

Hope this helps,

+++ Rick ---
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
Post by Ziong
Thx Olaf!
i'll study west wind's one, since i need to do post action.
thx once more.
Post by Olaf Doschke
Post by Olaf Doschke
= URLDownloadToFile (0, lcWebimage, lcLocalimage, 0, 0)
Sorry, that line should be
= URLDownloadToFile (0, lcWebpage, lcLocalfile, 0, 0)
here.. loading other files, like images is also possible of course...
Bye, Olaf.
Loading...