Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 XML to grab website data
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

redbrad0
Advanced Member

USA
3725 Posts

Posted - 31 July 2003 :  16:29:16  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I am using the code below to grab text from a webpage..


Function GetHTML(strURL)
	on error resume next
	Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
	objXMLHTTP.Open "GET", strURL, False
	objXMLHTTP.Send
	strReturn = objXMLHTTP.responseText
	Set objXMLHTTP = Nothing
	GetHTML = strReturn
End Function


I am looping thru about 200 sites checking some information on the site but the problem is if the site is down then my page just times out. Does anyone know a way around this? Where say if it takes longer then 30 - 45 secs it skips the site and goes to the next line of code?

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 31 July 2003 :  16:39:11  Show Profile
Can you not play around with the script.timeout, ie set it to 30 seconds and put on error resume next in your page.
I did a similar thing last year and found the xmlhttp object to be fairly unstable anyway and use c#(.net) instead, you've then got threading etc to speed things up.

The UK MkIVs Forum
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 31 July 2003 :  16:54:48  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well if the script timesout then the page will just not display so no further script can run right?

I have never used .net basically what I have is something simple but does take awhile for the code to run. My server has .net is this something that a .net program can grab the information and then be included into regular asp to run thru the rest of the querys?

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 31 July 2003 :  17:07:00  Show Profile
Yeah, I did a .net webservice that looped x sites then looped x search engines within (to find position in seaarch engine), this built up an XML file which was returned to a VB6 application using the XML object, so you could easily do something similar in ASP.

Anyway, I meant something like this origianally....

Server.ScriptTimeout = 30

Function GetHTML(strURL)
	on error resume next
	Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
	objXMLHTTP.Open "GET", strURL, False
	objXMLHTTP.Send
        if err.number <> 0 then
	    strReturn = objXMLHTTP.responseText
	    Set objXMLHTTP = Nothing
	    GetHTML = strReturn
        else
            Set objXMLHTTP = Nothing
            GetHTML = ""
        end if
End Function

The UK MkIVs Forum

Edited by - DavidRhodes on 31 July 2003 17:08:49
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 31 July 2003 :  17:17:00  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Well what I was saying is that when the script times out doesnt it stop all ASP after the 30 seconds?

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

seven
Senior Member

USA
1037 Posts

Posted - 31 July 2003 :  18:00:40  Show Profile  Visit seven's Homepage
sort of off topic, when you grab text from the webpage. Are you only grabbing specific text from the webpage or the whole page? I've been trying to do this but it always seems like you need to pull from specific DIV tags or it doesn't know where to pull from.

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 31 July 2003 :  18:08:55  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
yes i grabbing the entire page and then checking to see if certain data is contained in the html

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 31 July 2003 :  19:42:42  Show Profile  Visit Gremlin's Homepage
Thats basically the only way to do it, you can't selectively "tear" parts of a page.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 31 July 2003 :  23:40:20  Show Profile  Visit dayve's Homepage
quote:
Originally posted by Gremlin

Thats basically the only way to do it, you can't selectively "tear" parts of a page.



sure you can, I've done it before. You can search for certain html tags within a document, especially if they are unique tags. I used to do this to grab specific information from the census world population web site. Let me find an example of the script I used and I will post it shortly.

Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 31 July 2003 :  23:58:54  Show Profile  Visit dayve's Homepage
LINK: http://dayve.d2g.com/aspx/pdwp.aspx

I grabbed the details using XML from this site to make the above image:

http://www.census.gov/cgi-bin/ipc/popclockw

I used the <h1> tags as my delimiter


Edited by - dayve on 01 August 2003 00:12:07
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 01 August 2003 :  00:50:14  Show Profile  Visit Gremlin's Homepage
quote:
Originally posted by dayve

quote:
Originally posted by Gremlin

Thats basically the only way to do it, you can't selectively "tear" parts of a page.



sure you can, I've done it before. You can search for certain html tags within a document, especially if they are unique tags. I used to do this to grab specific information from the census world population web site. Let me find an example of the script I used and I will post it shortly.


I think you missunderstood what I was trying to say, you are selectivly taking stuff from the page AFTER you've "teared" it from the remote website, you can only HTMLHTTP an entire page at once, not part of it ... hmm that make sense ?

quote:
yes i grabbing the entire page and then checking to see if certain data is contained in the html

I was replying to that saying yes thats the only way to do it, you tear the page in it's entirety and then selectively determine which bits you want by using subsequent code etc.

Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 01 August 2003 00:52:15
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 01 August 2003 :  00:52:27  Show Profile  Visit dayve's Homepage
gotcha!

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 01 August 2003 :  03:21:30  Show Profile  Visit Gremlin's Homepage
:) ... I've actually been using XMLHTTP etc A LOT the last few weeks for various tasks, getting very good at writing complex instr and replace statements for pulling various bits of web content hehe.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

seahorse
Senior Member

USA
1075 Posts

Posted - 01 August 2003 :  03:41:40  Show Profile  Visit seahorse's Homepage
is there anyway to know that someone might be pulling text content from your site using this technique?

Ken
===============
Worldwide Partner Group
Microsoft
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 01 August 2003 :  05:16:48  Show Profile  Visit Gremlin's Homepage
it just looks like any other request from what I can tell in the logs.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

VodkaFish
Average Member

USA
654 Posts

Posted - 01 August 2003 :  13:09:38  Show Profile  Send VodkaFish an AOL message  Send VodkaFish an ICQ Message  Send VodkaFish a Yahoo! Message
I'm currently fiddling around with this solution: I'm reading someone else's XML file. They update every 10 minutes. I might have a lot of requests on my page for this, so I'm trying to set up a script to run every 10 minutes, get their info, store it on my own site, and then just read it from there. That way, if they go down, I still have the older info and my page won't have any lag.

v ø d k â f ï § h
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.9 seconds. Powered By: Snitz Forums 2000 Version 3.4.07