forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


http Fetch

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 Source Code
View previous topic :: View next topic  
Author Message
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 763
Location: Eastman, GA

PostPosted: Mon May 09, 2011 5:04 pm    Post subject: http Fetch Reply with quote

Similar to file copy,http:// for vds 6. Should be changed/modified to gosub, dsu or vdsx for implementation.

Code:


%1 = http://www.vdsworld.com/forum/download.php?id=324
%2 = @path(%0)vdsdom50.txt
list create,1
list add,1, 'Set your settings
list add,1,
list add,1, strFileURL = @chr(34)%1@chr(34)
list add,1, strHDLocation = @chr(34)%2@chr(34)
list add,1,
list add,1, ' Fetch the file
list add,1,
list add,1, Set objXMLHTTP = CreateObject(@chr(34)MSXML2.XMLHTTP@chr(34))
list add,1,
list add,1, objXMLHTTP.open @chr(34)GET@chr(34)"," strFileURL"," false
list add,1, objXMLHTTP.send()
list add,1,
list add,1, If objXMLHTTP.Status = 200 Then
list add,1, Set objADOStream = CreateObject(@chr(34)ADODB.Stream@chr(34))
list add,1, objADOStream.Open
list add,1, objADOStream.Type = 1 'adTypeBinary
list add,1,
list add,1, objADOStream.Write objXMLHTTP.ResponseBody
list add,1, objADOStream.Position = 0    'Set the stream position to the start
list add,1,
list add,1, Set objFSO = Createobject(@chr(34)Scripting.FileSystemObject@chr(34))
list add,1, If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
list add,1, Set objFSO = Nothing
list add,1,
list add,1, objADOStream.SaveToFile strHDLocation
list add,1, objADOStream.Close
list add,1, Set objADOStream = Nothing
list add,1, End if
list add,1,
list add,1, Set objXMLHTTP = Nothing
list savefile,1,@path(%0)fetch.vbs
run wscript @chr(34)@path(%0)fetch.vbs@chr(34),wait
file delete,@path(%0)fetch.vbs
list close,1
Back to top
View user's profile Send private message AIM Address
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu Mar 24, 2016 9:16 pm    Post subject: Reply with quote

Brandon... Thanks for sharing this. I know, a few years late, but only just found a need/use for it today. The VDS file copy in VDS 6 was giving me unreliable results, but your VBS solution here seems to not suffer the same as the File Copy command for webpages.

~Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Mar 30, 2016 12:10 am    Post subject: Reply with quote

If anyone runs into "Windows script host error 800700005" of "Access is denied"...

change the following line

Code:
LIST ADD,3, Set objXMLHTTP = CreateObject(@chr(34)MSXML2.XMLHTTP@chr(34))


to

Code:
LIST ADD,3, Set objXMLHTTP = CreateObject(@chr(34)MSXML2.ServerXMLHTTP@chr(34))

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group