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...
Code:$html=file_get_contents('SOME-WEB-ADDRESS'); $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){....and the code goes on.....
file_get_contents() return a string, you can concatenate the two string:
but I think it's useless.. what does your script do?Code:$html = file_get_contents('page1').file_get_contents('page2');
You can also make a function that contain your script and you use it for the two pages...
Thanks. It worked like a charm.
The script collects stock market data from two pages, processes it and stores it in a database.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks