Solved

How to capture XML returned from a cURL call with VBScript?

Posted on 2015-01-25
5
219 Views
Last Modified: 2015-01-26
I have a VBS program that successfully runs a cURL script, which accesses my API.  XML is returned to the screen fine.  However I want to capture the return from within the VBS script.  Here is what I have:

'*  Run a Curl command line

Set objXMLDoc = CreateObject("Msxml2.DOMDocument")
Set WSHShell = CreateObject("WScript.Shell")			
wSHShell.run("CMD.exe")
wscript.sleep 2000
wSHShell.run("CURL1.bat")

objXMLDoc.LoadXML .responseText

msgbox "Data returned is: " &objXMLDoc.SelectSingleNode("//recordID").text

Open in new window


I swiped the Doc.LoadXML.responseText from another script that worked fine when a log in was not required.    I just need to get the XML text into memory so I can pretty it up for display.
0
Comment
Question by:Mike Caldwell
  • 3
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40569920
Try adding "-o mygettext.xml" to your cURL command.  http://www.thegeekstuff.com/2012/04/curl-examples/  Then you can read the file.
0
 
LVL 1

Author Comment

by:Mike Caldwell
ID: 40569924
I already had it printing to a temp file.  What I am hoping I can get is for the XML stream to return to VBS so that I can format it, embed with some descriptors, and display on screen.  If I have to use a temp file I guess I'll do that, but looking for a way to avoid it.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40569947
I don't know how to get it to do that.
0
 
LVL 1

Author Comment

by:Mike Caldwell
ID: 40570023
I've posted this about three different ways and nobody offers the solution I'm looking for.  So I guess I'll go with the temp file.  Thanks Dave.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40570105
You're welcome.  I really don't the way you want exists.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question