Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#158905 - 04/05/2003 17:48 curl from WSH/VBScript
AndrewT
old hand

Registered: 16/02/2002
Posts: 867
Loc: Oxford, UK
Has anyone here used curl from these languages? I'm looking for a jumpstart if anyone has any tips or sample code (especially with Libcurl).


Edited by Rue (04/05/2003 17:56)

Top
#158906 - 05/05/2003 04:24 Re: curl from WSH/VBScript [Re: AndrewT]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5914
Loc: Wivenhoe, Essex, UK
Unless someone has already written a wrapper for libcurl that exposes it via COM's IDispatch (and have made sure that the return arguments are in a form that the Microsoft Script Engine can handle) then you are out of luck. Googling doesn't provide any evidence that anyone has done this.

If all you wanted to do was make HTTP and HTTPS calls then an alternative is the MSXMLHTTP object that is part of the MSXML parser. While is is designed for making HTTP calls to fetch XML it can be used just as easily to get the contents of web pages.

Here is a quick example of getting the contents of a webpage.

(warning, untested code...)

Dim oXmlHttp
Dim sWebPage

set oXmlHttp = CreateObject("MSXML2.XMLHTTP")

oXmlHttp.open "GET", "http://www.norman.cx/", false
oXmlHttp.send ""
sWebPage = oXmlHttp.responseText
_________________________
Remind me to change my signature to something more interesting someday

Top
#158907 - 05/05/2003 16:08 Re: curl from WSH/VBScript [Re: andy]
AndrewT
old hand

Registered: 16/02/2002
Posts: 867
Loc: Oxford, UK
Thanks for the suggestion about the MSXML parser, I think I can make good use of that somewhere else in my app. quite soon. The task I had in mind for curl is reliable FTP Get/Put.

I had originally planned to use Ncftp for FTP but I've since discovered that the API variant costs $500 and appears to be *nix only. I guess* I can still use the command line versions of either curl or Ncftp by invoking a cmd shell from WSH but I was looking for something more elegant

* (I am assuming that I can run the WSH script from task scheduler AND have it shell cmd windows without a user logged on interactively. I will try to test that shortly).

Top
#158908 - 05/05/2003 22:46 Re: curl from WSH/VBScript [Re: AndrewT]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5914
Loc: Wivenhoe, Essex, UK
I am assuming that I can run the WSH script from task scheduler AND have it shell cmd windows without a user logged on interactively. I will try to test that shortly

As far as I am aware there is no way to run EXEs direct from VBScript (unless WSH provides a way). I have always had to write an VB ActiveX DLL that I called to run EXEs from script (very simple DLL to write as it tends to be a one-liner).
_________________________
Remind me to change my signature to something more interesting someday

Top