View Full Version : Howto extract a webpage data using php and show on html ?
05-20-2004, 04:45 AM
Can anyone show me an example, that
using a php (or else, but not vbs, hope to run on both win/linux) to extract certain predefined
lines (actually news) on another internet site page and then show on my
own web page in html table ?? Any comments welcome.
call a new.php
get some content of a web
3) the content is display in index.html as plain text
I want to show dynamic news info like the util http://www.samurize.com
05-20-2004, 06:06 PM
Well you can ask the news site provider if you can get read-only access to some table in their database and hope for the best.
Or, you can 'steal' the content using cURL or Snoopy (PHP extension libraries) along with regular expressions. You'd use cURL or Snoopy to get the HTML source of the webpage, and then regular expressions to extract what it is you're looking for.
You're going to have to really study the HTML source of the news webpage so you know what it is you're looking for each time. I'm assuming the news webpage is dynamic, so it's not always going to be the same lines of HTML source you want.. that's why regular expressions would be good as long as you can abstract what will always be the same and where to look for it (depending on the site, it may not even be possible..)
Also keep in mind that in 'stealing' the news like this, your solution is highly dependent on the structure/layout of the news webpage. If the news provider changes their layout somewhat, it could possibly break your code. That's why getting in touch with them is better (although this may come at price...) as they might inform you that they're changing, or it may not matter as their database won't be changing, just the website..
But anyway, that's my thoughts on it anyway. Research these topics and you should find plenty of information to get the ball rolling. Post back if you run into any troubles.
05-20-2004, 07:51 PM
Don't create multiple threads with the same question.
All replies should now go to the original thread
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.