dropfaith Posted May 24, 2012 Share Posted May 24, 2012 Relevant Links http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml http://box1.host1free.com/~crimso/index.php (right side My Treasure section) <?php function getPagetreasure($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml"){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/'); curl_setopt($ch,CURLOPT_TIMEOUT,10); $xmltreasure=curl_exec($ch); if($xmltreasure==false){ $m=curl_error(($ch)); error_log($m); } curl_close($ch); return $xmltreasure; } $xmlfiletreasure = getPagetreasure("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml"); $treasure =new SimpleXMLElement($xmlfiletreasure); $resultst = array(); foreach ($treasure as $ttreasure){ $resultst[] = $ttreasure; } print_r($resultst); ?> I have it printing the array so you guys can see whats in it.. What im trying to do is build a simple 2 column table ie <table> <tr> <td class="label">Offer Due</td> <td>DATA FROM ARRAY HERE.</td> </tr> </table> i wont be using all the data in the array on this project prob like 4 items total Offer_Due, Total_Due,Total_Paid and maybe a few more as time goes on im clueless as to where to go from where my php is to where i need it to go at this point Link to comment https://forums.phpfreaks.com/topic/263023-print-html-table-from-php-array/ Share on other sites More sharing options...
Kays Posted May 24, 2012 Share Posted May 24, 2012 Why store it into $resultst? Just print it out as you would with $ttreasure. It can't possible be hard. You already done a very similar job some hours ago. Link to comment https://forums.phpfreaks.com/topic/263023-print-html-table-from-php-array/#findComment-1348191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.