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
 Community Discussions (All other subjects)
 XML - grab data from other sites
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  19:27:07  Show Profile  Send Astralis a Yahoo! Message
I have a site that I would like to grab headlines from other sites and put them on my site. I've been reading that I could create an XML file to do this and parse the data.

Could anyone point me to a resource to learn about this or explain how to do it? XML is still a little baffling to me.

BTW, before anyone comments, I have permission to grab the data and am currently doing it manually.

(Admins - could you please move this to the ASP category?)

Edited by - Astralis on 08 November 2003 19:35:27

dayve
Forum Moderator

USA
5820 Posts

Posted - 08 November 2003 :  19:37:55  Show Profile  Visit dayve's Homepage
Here is a combination of screen scraping and output displaying using the GDI.

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

The main part of the scraping is accomplished this way:


HTMLGet = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0") 
HTMLGet.Open("GET", "http://www.census.gov/cgi-bin/ipc/popclockw", false)
HTMLGet.Send 
strText = HTMLGet.responseText
HTMLGet = Nothing 

' Name
strName = strText : i = 0 : j = 0
i = instr(strName,"<h1>")
j = instr(i,strName,"</h1>")
strName = (mid(strName,i,j-i))

strLine1 = "World Population: "
strLine2 =  (replace(strName,"<h1>",""))

'### Concatenate Main String
strOutputText =	strLine1 & vbNewLine & _
		"   " & strLine2


You need to identify something in the page you want to scape. In the example above I used the <h1></h1> heading tags.

Once you have that, you can display the data anyway you want. Here is the entire script for the image shown above.

http://www.burningsoulsforum.com/pdwp.txt

You can also search the net for Screen Scraping. You can use the XML parser or the new .NET parser (which I am using for my signature portion on the far right).

Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  19:43:30  Show Profile  Send Astralis a Yahoo! Message
Wow! Thanks Dayve. Very useful.
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  20:20:06  Show Profile  Send Astralis a Yahoo! Message
Has anyone been able to screen scrape in Classic ASP. It seems that all the tutorials and examples on the search pages are for asp.net, as well as Dayve's example.
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 08 November 2003 :  21:00:44  Show Profile
Dayve's example looks pretty classic to me :)

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 November 2003 :  21:30:29  Show Profile  Visit Gremlin's Homepage
Definately a Classic :)

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

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  21:40:18  Show Profile  Send Astralis a Yahoo! Message
What would I need to do to replicate that? I'd like to look at how you did it by running it and deconstructing it on my server. If I copied the example from your link, should it work?

Gremlin and Doug said it's classic ASP but I thought you wrote it in for a .NET server - sorry.
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 08 November 2003 :  21:42:10  Show Profile  Visit dayve's Homepage
I wrote it using .NET because I needed to create an image. You can use the XML object and simply do a Response.Write with the string.

Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  21:45:04  Show Profile  Send Astralis a Yahoo! Message
I see you're listening to OMD - cool!
Go to Top of Page

RebelTech
Average Member

USA
613 Posts

Posted - 08 November 2003 :  21:52:42  Show Profile  Visit RebelTech's Homepage  Send RebelTech an ICQ Message
Also, do a google search for grabnews. It is a xml and db solution. It will grab headlines and store them in the database and will only update them every so often. Keeps the bandwidth down.
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 08 November 2003 :  23:49:32  Show Profile  Send Astralis a Yahoo! Message
Grabnews is cool. I'm still learning, though, how to grab headlines from sites without RSS Feeds.
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 09 November 2003 :  00:23:22  Show Profile  Send Astralis a Yahoo! Message
Thanks for your patience everyone. I'm trying to learn this.

On Planetsourcecode, there is a sample that will do exactly what I'm looking for. The author presumes the users will know the basics to the code so he only included essential codes. Unfortunately, I'm learning the basics right now. Using his code, what would I need to do to be able to create the exact sample that he created (seen in the screen-shot)?

View code on planetsourcecode.com.
Go to Top of Page

n8pbm
Junior Member

USA
212 Posts

Posted - 09 November 2003 :  09:19:21  Show Profile  Visit n8pbm's Homepage
Here is a link that will grab headlines fom any non XML news page and create a xml link for anyone to use: http://www.myrss.com/new.html

It works most of the time.

Mike
Great Lakes Pop Up Club Camping
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.39 seconds. Powered By: Snitz Forums 2000 Version 3.4.07