Solved

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

Posted on 2015-01-25
5
203 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 82

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 82

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 82

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now