Mike Caldwell
asked on
How to read the XML data returned from an API with VB Script?
I am trying to learn a bit more about VB scripting, as well as better understand how a client would use a simple API I have parked at a web site I own and have hosted at a cloud server. I can successfully access the URL (no credentials needed at this point) and properly submit the requested fields and operand. What comes back is a bunch of API text to my monitor. I need to know how to capture the stream without it being displayed, and then use the saved page of XML lines as TXT so that I can have my script then pick off what I want and present it in a MSGBOX.
Here is what successfully accesses it:
Set oShell = CreateObject("Wscript.Shel l")
oShell.Exec "C:\Program Files\Internet Explorer\iexplore.exe https://api.niftywebsite.net/?opts=WORD1&whatiwant=123456"
Here is what I get back in my browser:
<?xml version="1.0" encoding="UTF-8"?>
-<response>
-<entity>
<whatiwant>123456</whatiwa nt>
<WORD1>Just some test stuff</WORDS1>
</entity>
</response>
So can I suppress the monitor echo and pipe the XML text to a file? Better would be if I could just hold the text and access it without a file save / open / read.
Here is what successfully accesses it:
Set oShell = CreateObject("Wscript.Shel
oShell.Exec "C:\Program Files\Internet Explorer\iexplore.exe https://api.niftywebsite.net/?opts=WORD1&whatiwant=123456"
Here is what I get back in my browser:
<?xml version="1.0" encoding="UTF-8"?>
-<response>
-<entity>
<whatiwant>123456</whatiwa
<WORD1>Just some test stuff</WORDS1>
</entity>
</response>
So can I suppress the monitor echo and pipe the XML text to a file? Better would be if I could just hold the text and access it without a file save / open / read.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER