Solved

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

Posted on 2015-01-25
5
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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 …
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

752 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