VB6 - How to store URL contents in string and save as file(ex .txt) -


option explicit  public sub save_url_contents_as_text()       dim myurl string       dim myfile object    'store text file here       dim tempstring string      myurl = "www.anythingiwanttoputhere"      'i want here. function       tempstring = geturltext(myurl)      'i want save url text contents here       myfile = tempstring  end sub 

taken directly here. change url , filename desired. call writes contents of url disk file.

this example shows how use urldownloadtofile api function download file url file in visual basic 6.

private declare function urldownloadtofile lib "urlmon" _ alias "urldownloadtofilea" (byval pcaller long, _ byval szurl string, byval szfilename string, _ byval dwreserved long, byval lpfncb long) long  private sub form_load()   ' download file.   urldownloadtofile 0, _     "http://www.vb-helper.com/vbhelper_425_64.gif", _     "c:\vbhelper_425_64.gif", 0, 0  end sub 

Comments