Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Read a web page from a script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,30580
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read a web page from a script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Read a web page from a script - 2/2/2006 6:17:50 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
I am trying to figure out how to read a web page into a script and capture specific information off of it and store it some where.
 
 
Post #: 1
 
 RE: Read a web page from a script - 2/2/2006 7:44:46 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
check out the MSXML2.XMLHTTP object

here is an example:

getURL "http://www.google.com"



Sub getURL(url)
   Set objHTTP = CreateObject("MSXML2.XMLHTTP")

   WScript.Echo "********** start **************"

   Call objHTTP.Open("GET", url, FALSE)

   'WScript.Echo objHTTP.readyState
   objHTTP.Send

   'WScript.Echo objHTTP.readyState
   WScript.Echo "request returned status: " & objHTTP.status

   'uncomment the Next line if you want to see the actual source of the file
   WScript.Echo(objHTTP.ResponseText)

   WScript.Echo "********** End **************"
   WScript.Echo

End Sub

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to skione)
 
 
Post #: 2
 
 RE: Read a web page from a script - 2/2/2006 11:28:02 AM   
  hamboy

 

Posts: 94
Score: 6
Joined: 7/11/2005
Status: offline
hi skione

You can do this through PHP script & SQL more efficently. What you're doing is something called "Spidering" in the world of Internet.
www.php.net has great resources on how to spider web pages for data and pull out data strings that you need.

If you need additional help, try www.phpfreaks.com /repost here and I'll offer a hand

(in reply to kirrilian)
 
 
Post #: 3
 
 RE: Read a web page from a script - 2/3/2006 1:40:28 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
krillian thank you, thank you, thank you!

That is exactly what I was looking for!

hamboy thank you for giving me the correct vocabulary.

Basically I need to search a web page for a specific series of characters and then take the information just following those and store it somewhere (preferrably a SQL DB).

Here is the trick this web page is hosted on a printer.


(in reply to hamboy)
 
 
Post #: 4
 
 RE: Read a web page from a script - 2/3/2006 1:44:33 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Actually I need one other thing that I am not sure how to do.

I need to supply credentials when opening this web page.

I have no clue how to do that.

(in reply to skione)
 
 
Post #: 5
 
 RE: Read a web page from a script - 2/3/2006 1:57:50 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
youre going to have problems with that part of it, i couldnt ever get authentication to work reliably using that object.

you can try it though, change your url to reflect the login

eg.
getURL "http://kirrilian:password@www.google.com"

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to skione)
 
 
Post #: 6
 
 RE: Read a web page from a script - 2/3/2006 2:13:14 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Yeah that did not work for me, luckily I can change the security so that I can allow users to view the page but not change anything so that should be fine.

I am having a wierd problem, whereby I am trying to split the web page into an array so I can search and retrieve the info I need but the line I would normally use does not work:

pageArray = split(webPage, vbCrLf)

It just stores the whole page as one big array. What is the delimiter I should use?

Edit
NVM, It is VbLf.

Now to try and figure out how to read it.

< Message edited by skione -- 2/3/2006 2:17:56 AM >

(in reply to kirrilian)
 
 
Post #: 7
 
 RE: Read a web page from a script - 2/3/2006 3:06:34 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Well this is what I came up with. It will only work on the Xerox Phaser line of printers (this works for the 8400)

I have some code that will read a listand convert it to and array this way I can loop through all the printers.

Then I just have to figure out how to get it into a SQL db.

A simple query should work I am guessing. Not that I know how to run a query from within a script yet.

      

(in reply to skione)
 
 
Post #: 8
 
 RE: Read a web page from a script - 2/3/2006 4:10:48 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
quote:

ORIGINAL: kirrilian

youre going to have problems with that part of it, i couldnt ever get authentication to work reliably using that object.

you can try it though, change your url to reflect the login

eg.
getURL "http://kirrilian:password@www.google.com"


I know this is a triple post but I found out how to passa a username/password use the following:


Call objHTTP.Open("GET", url, FALSE, strUserName , strPassword)

(in reply to kirrilian)
 
 
Post #: 9
 
 RE: Read a web page from a script - 2/15/2006 12:09:10 AM   
  netxman

 

Posts: 118
Score: 0
Joined: 8/1/2005
Status: online
Hi,kirrilian

Can you tell me how to find the reference of MSXML2.XMLHTTP object?

I cannot find it in MICROSOFT VBSCRIPT REFERENCE and msdn with keyword "MSXML2.XMLHTTP"

Thank you very much.

(in reply to skione)
 
 
Post #: 10
 
 RE: Read a web page from a script - 2/15/2006 12:16:29 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
This might help you get started:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceappservices5/html/wce50lrfIXMLHTTPRequest.asp

(in reply to netxman)
 
 
Post #: 11
 
 RE: Read a web page from a script - 2/16/2006 12:05:03 PM   
  netxman

 

Posts: 118
Score: 0
Joined: 8/1/2005
Status: online
Thank you Skione.

But I still don't know how to know this can be used in vbscript.

If never seen the example of kirrilian, I absolutely can't think it out.

:(

(in reply to skione)
 
 
Post #: 12
 
 RE: Read a web page from a script - 2/17/2006 12:51:18 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Well I posted in this thread and example of its use.

What exactly are you trying to do?

(in reply to netxman)
 
 
Post #: 13
 
 RE: Read a web page from a script - 2/17/2006 2:30:25 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:

ORIGINAL: skione

quote:

ORIGINAL: kirrilian

youre going to have problems with that part of it, i couldnt ever get authentication to work reliably using that object.

you can try it though, change your url to reflect the login

eg.
getURL "http://kirrilian:password@www.google.com"


I know this is a triple post but I found out how to passa a username/password use the following:


Call objHTTP.Open("GET", url, FALSE, strUserName , strPassword)


excellent! I've been looking for a way to do that for some time. Thanks!

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to skione)
 
 
Post #: 14
 
 RE: Read a web page from a script - 2/17/2006 2:33:06 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Happy to be of help!

(in reply to kirrilian)
 
 
Post #: 15
 
 RE: Read a web page from a script - 2/17/2006 2:43:16 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
I have posted a subroutine in the "post a script" section that works with authenticated http, now if i could just get it to work with ftp as well...

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to kirrilian)
 
 
Post #: 16
 
 RE: Read a web page from a script - 2/17/2006 2:48:52 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
ftp uses it's own script lanuage

Create a text (in this example called script.txt) file with the commands:
open ftp.domain.com
username
password
cd public_html
dir
get file.txt
bye

then type at the command prompt:
ftp -s:script.txt


(in reply to kirrilian)
 
 
Post #: 17
 
 RE: Read a web page from a script - 2/19/2006 4:11:55 PM   
  netxman

 

Posts: 118
Score: 0
Joined: 8/1/2005
Status: online
quote:

ORIGINAL: skione

Well I posted in this thread and example of its use.

What exactly are you trying to do?



Yes I saw it, I just want to know more about its usage.

Thank you.

(in reply to skione)
 
 
Post #: 18
 
 RE: Read a web page from a script - 2/20/2006 1:59:19 AM   
  skione

 

Posts: 40
Score: 0
Joined: 10/1/2005
Status: offline
Ah

Are you trying to accomplish anything specific?

(in reply to netxman)
 
 
Post #: 19
 
 RE: Read a web page from a script - 2/20/2006 2:20:12 PM   
  netxman

 

Posts: 118
Score: 0
Joined: 8/1/2005
Status: online
Not yet, I dont know how to use it. But let me think..

Does this method can have the function of netcat ?

Just like :

c:\> nc -vv www.google.com 80

and submit something..?

(in reply to skione)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read a web page from a script Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts