Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
dvd information
finance products
dropshippers
 Downloads
dzphp editor
EasyPHP
mysql_phpgenerator
php-studio-trial
phpdesigner_7_2_5
phpMyAdmin-3.4.3.2
/phptriad2-2-1
phpxedit_321
rapidphp 2011
WampServer2.1d-x64
WampServer2.1e-x32
xampp-win32-1.7.4-VC6-installer
xampplite-win32-1.7.3
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


A currency convertor


A currency convertor

This is a currency convertor which allows a user to get the latest currency conversions from Yahoo . This example will convert 1 British pound to 5 other currencies .

Code:

<?
//our currencies
$currency = array("Yen","US Dollars","German mark","french franc","Australian dollar");
//the various URLS for the currency conversions
$conv[0]=file('http://quote.yahoo.com/m5?a=1&s=GBP&t=JPY&c=0');
$conv[1]=file('http://quote.yahoo.com/m5?a=1&s=GBP&t=USD&c=0');
$conv[2]=file('http://quote.yahoo.com/m5?a=1&s=GBP&t=DEM&c=0');
$conv[3]=file('http://quote.yahoo.com/m5?a=1&s=GBP&t=FRF&c=0');
$conv[4]=file('http://quote.yahoo.com/m5?a=1&s=GBP&t=AUD&c=0');
//loop through results
for($i=0; $i<sizeof($conv); $i++)
{
$conv[$i] = join("",$conv[$i]);
//parse out the relevant information
$conv[$i] = ereg_replace(".*<table border=1 cellpadding=2 cellspacing=0>",'',$conv[$i]);
$conv[$i] = ereg_replace("</table>.*",'',$conv[$i]);
$conv[$i] = ereg_replace("</b>.*",'',$conv[$i]);
$conv[$i] = ereg_replace(".*<b>",'',$conv[$i]);
//display results
echo "1 Pound(£) = ".$conv[$i]." ".$currency[$i]."<br>\n";
}
?>

Example :

 


Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/beginne/public_html/currency.php on line 204

Warning: file(http://quote.yahoo.com/m5?a=1&s=GBP&t=JPY&c=0) [function.file]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/currency.php on line 204

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/beginne/public_html/currency.php on line 205

Warning: file(http://quote.yahoo.com/m5?a=1&s=GBP&t=USD&c=0) [function.file]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/currency.php on line 205

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/beginne/public_html/currency.php on line 206

Warning: file(http://quote.yahoo.com/m5?a=1&s=GBP&t=DEM&c=0) [function.file]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/currency.php on line 206

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/beginne/public_html/currency.php on line 207

Warning: file(http://quote.yahoo.com/m5?a=1&s=GBP&t=FRF&c=0) [function.file]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/currency.php on line 207

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/beginne/public_html/currency.php on line 208

Warning: file(http://quote.yahoo.com/m5?a=1&s=GBP&t=AUD&c=0) [function.file]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/currency.php on line 208

Warning: join() [function.join]: Invalid arguments passed in /home/beginne/public_html/currency.php on line 212
1 Pound(£) = Yen

Warning: join() [function.join]: Invalid arguments passed in /home/beginne/public_html/currency.php on line 212
1 Pound(£) = US Dollars

Warning: join() [function.join]: Invalid arguments passed in /home/beginne/public_html/currency.php on line 212
1 Pound(£) = German mark

Warning: join() [function.join]: Invalid arguments passed in /home/beginne/public_html/currency.php on line 212
1 Pound(£) = french franc

Warning: join() [function.join]: Invalid arguments passed in /home/beginne/public_html/currency.php on line 212
1 Pound(£) = Australian dollar


 




Books
 Sponsors


 Random Code
show all rows in a MySQL table(database)
date and time example(date and time)
bbc science/nature with PEAR packages(xml)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials
Get PHP
Programmers help




beginners PHP Copyright © 2004 onwards by beginnersPHP.