Get part of source code

Discussion in 'PHP' started by zodiakasxxx, Mar 16, 2010.

  1. #1
    In website A I want to gather some of website's B content. For example, I need to get website's B code lines 17-20 and store that text in website's A variable $text_from_website_b . How this code should look like?
     
    zodiakasxxx, Mar 16, 2010 IP
  2. scvinodkumar

    scvinodkumar Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use preg_match function to get the content
     
    scvinodkumar, Mar 16, 2010 IP
  3. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #3
    If it's going to be lines 17-20 every time you could split by new lines in to an array, and just access elements 16-19 of the array.
     
    Alex Roxon, Mar 17, 2010 IP
  4. zodiakasxxx

    zodiakasxxx Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Best idea yet...
     
    zodiakasxxx, Mar 17, 2010 IP
  5. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #5
    In which case the OP could use file()
     
    danx10, Mar 17, 2010 IP