// Render the page with full html code function render_page ($title, $body) { echo ''; echo "\n\n
\n"; echo "Back to Problem Set index page
\n"; echo "\n"; echo ""; } // Construct title and body-content for page rendering function construct_page ($dollarxr) { $now = date("Y-m-d H:i:s"); $kroner = 100*$dollarxr; $dollars = 100/$dollarxr; $title = "Dollar exchange rate service - $now"; $body = "Currently ($now) the exchange rate is $dollarxr.
" ."For \$100.00 you get kr.$kroner
" ."For kr.100.00 you get \$ $dollars
"; render_page ($title, $body); } // Get the HTML page that contains the dollar exchange rate $content = file_get_contents ("http://se.finance.yahoo.com/m5?a=1&s=USD&t=DKK"); // The pattern to use with the ereg command $pattern = 'USDDKK.+" ."Please send me an thorarinn@itu.dk."); } ?>