1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

HELP! - file_get_contents

Discussion in 'PHP' started by maros174, Oct 27, 2009.

  1. #1
    Hi all,

    How can I "fill" the varable $html with the contents from two files(locations), using the same function file_get_contents ?
    Below is a part of the code that I use, it is working perfectly - I just need to collect the data from two web addresses (instead of one) and place it inside the variable $html

    Any help will be hugely appreciated...

            $html=file_get_contents('http://www.WebAddress.com');
            $pattern="|<tr[^>]+tip='D'>(.*)</tr+>|U";
            preg_match_all($pattern, $html, $elements);
            $MasterData=array();
            
            foreach($elements[1] AS $ei => $element){
                $pattern="|Model=(.*)'|U";
                preg_match_all($pattern, $element, $Info);
                $pattern="|<td+>(.*)</td+>|U";
                preg_match_all($pattern, $element, $MultiData);
      
                foreach($MultiData[1] AS $tdi => $Data)
                    $MasterData[$Info[1][0]][$tdi]=$Data;
            }
            
            foreach($Data AS $oznaka => $data1){[COLOR="Silver"][I]....and the code goes on.....[/I][/COLOR]
    Code (markup):
     
    maros174, Oct 27, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $html = file_get_contents('http://www.example1.com').file_get_contents('http://www.example1.com');
    PHP:
    Like that?
     
    JAY6390, Oct 27, 2009 IP