Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2004
    Thanked 0 Times in 0 Posts

    Howto extract a webpage data using php and show on html ?

    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.

    1) index.html
    call a new.php

    2) 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

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Thanked 0 Times in 0 Posts
    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.


  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Marion, IA USA
    Thanked 83 Times in 82 Posts
    Don't create multiple threads with the same question.

    All replies should now go to the original thread

    Howto extract a webpage data using php and show on html ?

    Closing thread...
    CodingForums Supreme Overlord
    All Hail Spookster


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts