I want to display very large XML-feeds without putting too much pressure on either the CPU or the memory. Because of that feeds can no longer be put into memory, but have to be processed in an alternative way.
I have two url to curl one is with limit:http://pf.tradetracker.net/?aid=1&type=xml&encoding=utf-8&fid=251713&categoryType=2&additionalType=2&limit=5000
and other is without limit: http://pf.tradetracker.net/?aid=1&type=xml&encoding=utf-8&fid=251713&categoryType=2&additionalType=2
<?php ini_set('memory_limit', '32M'); $feed_url = "http://pf.tradetracker.net/?aid=1&type=xml&encoding=utf-8&fid=251713&categoryType=2&additionalType=2&limit=5000"; $c = curl_init($feed_url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $xmlstr = curl_exec($c); curl_close($c); $xml_feed_obj = json_decode(json_encode((array) simplexml_load_string($xmlstr)), 1); foreach($xml_feed_obj as $products_feed) { foreach($products_feed as $feed) { $html = "<link href='http://localhost/task/style.css' rel='stylesheet' type='text/css' /><div class='rightcontainer' style='margin-top:10px;'><div class='flexslider carousel'><ul class='slides'><li><img src='".$feed->imageURL."' width='80' height='80'/><div class='caption-info'><div class='caption-info-head'><div class='caption-info-head-left'><h4>Product Name: ".$feed->name."</h4><br><span>Price: ".$feed->price."</span></div><div class='clear'> </div></div></div></li></ul></div> </div>"; ob_start(); echo $html; $return_html = ob_get_contents() ; } } echo $return_html;?>
When I curl the url, it will take time to display and used memory.