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.

Link to comment
Share on other sites

<?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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.