Hi,
I think the foreach statement is correct but not to sure how to fix:
[PHP]<?php
for($i=1;$i<300 0;$i++) {
$data = file_get_conten ts('http://www.website.com ?id='.$i);
$data = strip_tags($dat a,"<tr>");
$data = explode("<tr>", $data);
foreach($data as $index => $value) {
mysql_query("IN SERT INTO `table` (entry, entry2, entry3, entry4, entry5) VALUES ('" . $data[12] . "', '" . $data[13] . "', '" . $data[14] . "', '" . $data[15] . "', '" . $data[16] . "')");
}
}
?>[/PHP]
Table structure that i am extracting data from is:
[HTML]<table width="385" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td valign="top"><h 1>Company Name</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="3" >
<tr>
<th width="30%"><st rong>Contact:</strong></th>
<td width="70%"><st rong>Persons Name
</strong> </td>
</tr>
<tr>
<th><strong>Tel :</strong></th>
<td><strong>0 00 000 000</strong></td>
</tr>
<tr>
<td> </td>
<td><span class="small">I nformation Here</span>.</td>
</tr>
<tr>
<th><strong>E-mail:</strong></th>
<td><strong>< a href="info@webs ite.com">info@w ebsite.com</a></strong></td>
</tr>
<tr>
<th><strong>W eb site:</strong></th>
<td><strong>< a href="http://www.website.com " target="_blank" id="451" onClick="return trackclick(this .id);" title="Visit Site">www.websi te.com</a></strong></td>
</tr>
</table>[/HTML]
Any ideas?
Cheers,
Adam
I think the foreach statement is correct but not to sure how to fix:
[PHP]<?php
for($i=1;$i<300 0;$i++) {
$data = file_get_conten ts('http://www.website.com ?id='.$i);
$data = strip_tags($dat a,"<tr>");
$data = explode("<tr>", $data);
foreach($data as $index => $value) {
mysql_query("IN SERT INTO `table` (entry, entry2, entry3, entry4, entry5) VALUES ('" . $data[12] . "', '" . $data[13] . "', '" . $data[14] . "', '" . $data[15] . "', '" . $data[16] . "')");
}
}
?>[/PHP]
Table structure that i am extracting data from is:
[HTML]<table width="385" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td valign="top"><h 1>Company Name</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="3" >
<tr>
<th width="30%"><st rong>Contact:</strong></th>
<td width="70%"><st rong>Persons Name
</strong> </td>
</tr>
<tr>
<th><strong>Tel :</strong></th>
<td><strong>0 00 000 000</strong></td>
</tr>
<tr>
<td> </td>
<td><span class="small">I nformation Here</span>.</td>
</tr>
<tr>
<th><strong>E-mail:</strong></th>
<td><strong>< a href="info@webs ite.com">info@w ebsite.com</a></strong></td>
</tr>
<tr>
<th><strong>W eb site:</strong></th>
<td><strong>< a href="http://www.website.com " target="_blank" id="451" onClick="return trackclick(this .id);" title="Visit Site">www.websi te.com</a></strong></td>
</tr>
</table>[/HTML]
Any ideas?
Cheers,
Adam
Comment