Can PHP Do This?

Discussion in 'PHP' started by fireflyproject, Aug 13, 2007.

  1. #1
    If I were to write a script in PHP, would the script be able to load a certain web page and pull out certain pieces of information, such as blog post titles? Or would this be a better thing for, let's say, PERL to do?
     
    fireflyproject, Aug 13, 2007 IP
  2. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #2
    it is best to use which ever you can code better.. That would be my choice..

    Most of scripting languages can do what you want.. asp/php/perl etc.. stick to what you know best..
     
    hasbehas, Aug 13, 2007 IP
  3. void

    void Peon

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, that's possible. You could either use file_get_contents() or cURLfunctions to retrieve the page, then parse it using a regular expression for example.
     
    void, Aug 13, 2007 IP
  4. MykeXero

    MykeXero Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As far as php goes...

    file_get_contents is by the simplest way to get a page.

    But if you need to have the script login to a site, and do some other complicated web-browser type actions, curl is the way to go.

    All the rest is up to some smart string parsing.

    Stealing someones content eh? :D
     
    MykeXero, Aug 13, 2007 IP
  5. colinrgodsey

    colinrgodsey Banned

    Messages:
    125
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    PHP has the ability to do this. i recommend using one of the available PEAR xml parsers. For valid xhtml websites, this makes breaking em apart very easy. ive made a crawler with php before and ruby. theyve both worked good.
     
    colinrgodsey, Aug 13, 2007 IP
  6. fireflyproject

    fireflyproject Active Member

    Messages:
    969
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    70
    #6

    Haha, for personal reading, yes. :p I'm looking into creating my own personal "iGoogle". I already use that service, but I'd like to create something of my own, not based on RSS, just in case someone doesn't use it for their site. I think that might be a nifty way to do it.
     
    fireflyproject, Aug 13, 2007 IP