Hello
I thought I had it all figured out, but apparently not.
I want to write content from an RSS feed into an HTML table. I dont want all of it in one big pile, so I tried using some tricks and regular expressions.
This is a snippet from the feed:
<?xml version="1.0" encoding="utf-8" ?>
- <root>
- <products>
- <product>
<categoryPath>Stuff</categoryPath>
<productName>product_name_01</productName>
<productCode>22-356-12/756</productCode>
<eanNumber />
<manufactorSku />
<price>9999.00</price>
<deliveryCost>0.00</deliveryCost>
<deliveryTime>5 - 10 days</deliveryTime>
<availability>In Stock</availability>
<url>http://home.com/boats/fuel.aspx</url>
</product>
...
</products>
- </root>
This is my code:
$html = file_get_contents('http://home.com/feed/feedfile.aspx');
preg_match_all('/<product>.+<\/product>/', $html , $strng); // Reg_ex
echo "<table border=\"1\"> <tr><th>Link</th></tr>";
foreach($strng as $url) {
echo "<tr><td>";
echo $url;
print_r($url);
echo "</td></tr>";
}
I am getting this result:
Link Title
ArrayArray ( )
Can anyone help me identify what am I doing wrong and help me in the right direction.