Is there PHP snippet for extracting site's content?

Discussion in 'PHP' started by lovelycesar, Aug 20, 2008.

  1. #1
    Is there any PHP snippet for extraction "title", "meta tags", "body contents", and "images" providing from an URL? Thank if sharing.
     
    lovelycesar, Aug 20, 2008 IP
  2. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yes u can

    do
    file_get_contents();

    then parse that using preg_match
     
    William[ws], Aug 20, 2008 IP
  3. Christian Little

    Christian Little Peon

    Messages:
    1,753
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There's also CURL, open(), and various other libraries that will do it. I personally prefer CURL, so many options and ways to customize it.
     
    Christian Little, Aug 20, 2008 IP
  4. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #4
    get_meta_tags()
    PHP:
    php.net/get_meta_tags
     
    Agent_Smith, Aug 20, 2008 IP
  5. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yea use curl then get_meta_tags();
     
    William[ws], Aug 20, 2008 IP
  6. thankyou

    thankyou Well-Known Member

    Messages:
    558
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #6
    How do i do that?
    file_get_contents('tags?')?:confused:
     
    thankyou, Aug 20, 2008 IP
  7. lovelycesar

    lovelycesar Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I tried with get_meta_tags() and file_get_contents(). get_meta_tags() is fine, but file_get_contents() is sometimes refused by the targeted server. Thanks bros, I'll try cURL lib.
     
    lovelycesar, Aug 20, 2008 IP