freaka Posted April 10, 2007 Share Posted April 10, 2007 I maintain a website at work and every morning I have to update interest rates. I get them from a website (http://www.rbsgc.com/rbsgcconnect/home.aspx) but I want to know how (or if it's even possible) to include these rates from the website. The rates i need are: UST Swaps US Agencies CMBS They are allready in tables that match my layout if it makes it easier to just include the tables. Thanks a ton. Quote Link to comment Share on other sites More sharing options...
tarun Posted April 10, 2007 Share Posted April 10, 2007 Its Called Parsing But I Dont Know How To Do It... Sorry Quote Link to comment Share on other sites More sharing options...
freaka Posted April 10, 2007 Author Share Posted April 10, 2007 Thanks for the clue man. Quote Link to comment Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 <?php $file = file_get_contents('http://www.rbsgc.com/rbsgcconnect/home.aspx'); // start parsing here $file = spliti("</table>", $file); // splits the file at the </table> tag foreach ($file as $table) { if (eregi('UST', $table)) { } else { continue; } } ?> There is a start for you. Quote Link to comment Share on other sites More sharing options...
freaka Posted April 10, 2007 Author Share Posted April 10, 2007 Yeah I'm retarded... what am I supposed to do with that? Quote Link to comment Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 Make it work? =) Quote Link to comment Share on other sites More sharing options...
freaka Posted April 10, 2007 Author Share Posted April 10, 2007 but it doesnt work, when i put that in a file i get this: ", $file); // splits the file at the tag foreach ($file as $table) { if (eregi('UST', $table)) { } else { continue; } } ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 Use [ code ] and [ /code ] tags when pasting code makes it easier. <?php $file = file_get_contents('http://www.rbsgc.com/rbsgcconnect/home.aspx'); // start parsing here list(,$file) = spliti("<TABLE id=\"tblData\"", $file); $file = spliti("<table class=\"HomeGrid2\"", $file); foreach ($file as $table) { if (eregi('UST', $table)) { $table = str_replace('<td nowrap="nowrap" align="Right">', '', $table); list($header,$yr2, $yr5, $yr10) = spliti('<tr class="HomeGrid2row">', $table); list(,$year2_rate, $year2_rate2, $year2_rate3) = spliti('</td>', $yr2); list(,$year5_rate, $year5_rate2, $year5_rate3) = spliti('</td>', $yr5); list(,$year10_rate, $year10_rate2, $year10_rate3) = spliti('</td>', $yr10); }else { continue; } } ?> There is the first table section, the rest are going to be similar, hopefully you can figure it out because this is as far as I am willing to code for you without getting paid. As it is also a violation of the rules. That is more than enough information for you to take the reigns. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.