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. Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/ 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 Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226012 Share on other sites More sharing options...
freaka Posted April 10, 2007 Author Share Posted April 10, 2007 Thanks for the clue man. Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226013 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. Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226023 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? Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226025 Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 Make it work? =) Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226038 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; } } ?> Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226042 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. Link to comment https://forums.phpfreaks.com/topic/46458-help-with-including-information-from-another-site/#findComment-226174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.