This is for where i work. I need a script that can read our suppliers website and then get the values from a table.
Here is what
$fileaddy = 'http://www.mysupplierswebsite.com';
$lines = file($fileaddy);
$l_count = count($lines);
for($x = 0; $x< $l_count; $x++)
{
$curline = $lines[$x];
$linedisp[] = $curline;
}
$step1 = $linedisp[221];
//here is where the data needs to be extracted
echo $step1;
I have tried using "str_replace" like this:
//$step4 = explode('<td valign=top width="', $step1);
//$step5 = strip_tags($step4[$i]);
//$step5 = str_replace ('<img src="../images/buttons/camera_white.gif" width="20" height="15" border="0">', "", $step4[$i]);
//$step6 = str_replace ('100">', "", $step5);
//$step7 = str_replace ('<td valign=top>', "<br>", $step6);
//$step8 = str_replace ('</a></><div align="center"></div></><div align="center"></div></>', "", $step7);
but it wont work.
Lets just say that $linedisp[221] is the following
<a href="product.php?id=12>product name</a><br>
Sureley there is a way to simply get the 'product name' section and remove the rest'?
I know i can use strip_tags for that example but what if $linedisp[221] was the following
<a href="product.php?id=12>product name</a><br><a href=website.php?id=12>product description</a></br>
I need to be able to get both the product name and product description sections. Strip Tags will just combine the 2 making it hard to seperate them.
any ideas?
Thanks in advance.