SCRIPT: XMLGetter 
Author Message
 SCRIPT: XMLGetter

Similar to the MSKB article retrieval.  This is designed for "safe surfing" to
"Check this out!" links... ;-).  It will echo out the source data of the target;
it can just as easily be written to a local text file.  If you run it in GUI
mode, of course, you can use Ctrl-C to copy the echoed text and paste it into
YFTE (Your Favorite Text Editor) for closer examination.

Drawbacks: it will have problems, it appears, with bookmark references in
pages - so if you have a URL with something like "#abookmark" on the end, you
will need to trim that off.

Trivial script, but handy.

Option Explicit
GetViaXML(Inputbox("Enter a full URL."))

Sub GetViaXML(sData)
 Dim objXMLHTTP, xml
 ' Create an xmlhttp object:
 Set xml = CreateObject("Microsoft.XMLHTTP")
 ' Opens the connection to the remote server.
 xml.Open "GET", sData
 ' Actually Sends the request and returns the data:
 xml.Send
 do while xml.readystate<>4:wscript.sleep 10:loop
 wscript.echo xml.responsetext
End Sub



Fri, 08 Oct 2004 02:32:33 GMT  
 SCRIPT: XMLGetter
Why not just do a syncrhronos open to start with and avoid the readystate loop?

Quote:
> Option Explicit
> GetViaXML(Inputbox("Enter a full URL."))

> Sub GetViaXML(sData)
>  Dim objXMLHTTP, xml
>  ' Create an xmlhttp object:
>  Set xml = CreateObject("Microsoft.XMLHTTP")
>  ' Opens the connection to the remote server.

 xml.Open "GET", sData, False
 ' Actually Sends the request and returns the data:

Quote:
>  xml.Send
>  wscript.echo xml.responsetext
> End Sub

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--


Fri, 08 Oct 2004 02:54:35 GMT  
 SCRIPT: XMLGetter
OK... why not? ;-)

Didn't know you could do that.



Why not just do a syncrhronos open to start with and avoid the readystate loop?

Quote:
> Option Explicit
> GetViaXML(Inputbox("Enter a full URL."))

> Sub GetViaXML(sData)
>  Dim objXMLHTTP, xml
>  ' Create an xmlhttp object:
>  Set xml = CreateObject("Microsoft.XMLHTTP")
>  ' Opens the connection to the remote server.

 xml.Open "GET", sData, False
 ' Actually Sends the request and returns the data:

Quote:
>  xml.Send
>  wscript.echo xml.responsetext
> End Sub

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--


Fri, 08 Oct 2004 03:30:05 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VBScript 5.5 Crashes on Script Error in Script Event

2. script debugger to trace into vb scripts??

3. Valid script does not work with Scripting Object Model

4. Passing value from Server script to client script.

5. Calling server-script from within client-script

6. Valid script does not work with Scripting Object Model

7. Script edit control or programmable script editor??

8. Novice Java Script V.S.VB Script Question?

9. Exchange Scripting with VB Script

10. Client side scripting / server side scripting

11. vbscript login scripts - starting a script from the Windows 95 command prompt

12. script debugger to trace into vb scripts??

 

 
Powered by phpBB® Forum Software