Jump to content

Help with including information from another site


freaka

Recommended Posts

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.

<?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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.