For some reason
page 1.html // get contents from page 2.html
[code=php]
function get_tag($htmlel ement,$attr, $value, $html)
{
$attr = preg_quote($att r);
$value = preg_quote($val ue);
if($attr!='' && $value!='')
{
$tag_regex = '/<'.$htmlelement .'[^>]*'.$attr.'="'.$ value.'" width="100%">(. *?)<\\/'.$htmlelement. '>/si';
$matchCount = preg_match($tag _regex,$html,$m atches);
if ($matchCount > 0)
{
echo("$matchCou nt matches found.\n");
}
else
{
echo("no records");
}
}
}
$htmlcontent = file_get_conten ts("http://page2.html/");
$extract = get_tag("table" ,"class", "tablemenu" , $htmlcontent);
echo $extract;
[/code]
page2.html
I would like to grab all of the tables from the page and display them on another one.
[code=html]
// more code
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
// more code
[/code]
I have kept trying but had no luck :(
page 1.html // get contents from page 2.html
[code=php]
function get_tag($htmlel ement,$attr, $value, $html)
{
$attr = preg_quote($att r);
$value = preg_quote($val ue);
if($attr!='' && $value!='')
{
$tag_regex = '/<'.$htmlelement .'[^>]*'.$attr.'="'.$ value.'" width="100%">(. *?)<\\/'.$htmlelement. '>/si';
$matchCount = preg_match($tag _regex,$html,$m atches);
if ($matchCount > 0)
{
echo("$matchCou nt matches found.\n");
}
else
{
echo("no records");
}
}
}
$htmlcontent = file_get_conten ts("http://page2.html/");
$extract = get_tag("table" ,"class", "tablemenu" , $htmlcontent);
echo $extract;
[/code]
page2.html
I would like to grab all of the tables from the page and display them on another one.
[code=html]
// more code
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
<table width="100%" class="tablemen u">
<tbody>
<tr>
<td>
// some data
</td>
</tr>
</tbody>
</table>
// more code
[/code]
I have kept trying but had no luck :(
Comment