[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

php currency converter

Posted on 2002-07-17
20
Medium Priority
?
687 Views
Last Modified: 2008-02-01
Most currency converters seem to be written in PHP.

I have no experience in this area - anyone know where I can get a script - not one of those linked to another site: ie; hosted somewhere else.

I want to put the script on my server.
0
Comment
Question by:bankle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 4
  • +2
20 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7159227
Having a script to offer clients the conversions is fine, but where do you intend to get the actual exchange rates from?

You will probably find that you will need to buy that service from someone. Or manually update it once a hour/day/week/etc.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7159266
Alternatively, you can use a script to grab the current rates from another website (this may be naughty and prohibited in some way - not sure).

There is a script at ...

http://www.hotscripts.com/Detailed/11874.html

but I've not used it, but I cannot get a download.

Also ...

http://skintech.skinbase.org/xchanger/install.php

which seems to allow you to be sent updates of the new rates.

Richard.
0
 

Author Comment

by:bankle
ID: 7159311
I have subscribed to an exchange rate update service.

I need a currency converter script. That is the question.

Not exchange rates.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:dkjariwala
ID: 7159320
So wat does that service provide you ?

I mean in which form it provides the latest,updated exchange rates ?

JD
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7159352
The second script seems to offer what you want. It asks how much in 1 and gives you the amount in another.

0
 

Author Comment

by:bankle
ID: 7164327
I am having trouble installing it.

I found a free php hosting service.

I uploaded the files to a folder "calc" and followed the rest of the instructions, but got all sorts of errors. No idea what I am doing wrong - no experience with php.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7164335
What sort of errors?
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7164632
Exactly.

Can you give us error messages which you got ?
JD
0
 

Author Comment

by:bankle
ID: 7165990
Here is URL of "install.php"

http://auntypizza.port5.com/calc/install.php
There is an error message at the top.

When I put in my username and password, I get this . . .

Warning: MySQL Connection Failed: Access denied for user: 'auntypiz@localhost' (Using password: YES) in /host/a/u/n/p/o/r/auntypizza.port5.com/calc/install.php on line 40
Could not connect

0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7166445
The problem is that the parameters you supplied to mysql_connect() are not ok.

The username/password combination is wrong. Verify them with your mysql admin and it will be done.

JD
0
 

Author Comment

by:bankle
ID: 7166884
Remember - I know NOTHING about PHP - so I don't know what
"mysql_connect()" means . . . I put in the username I used to register at this site, then they sent me a password.

I registered at http://www.portland.co.uk/

I just added the hosted database, but it still doesn't work?

 
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7167580
Have you got any database hostname, username and password for your hosted database ?

Put up install.php code here,i tell you where to put those details.

JD
0
 

Author Comment

by:bankle
ID: 7181170
I have sent an email requesting database hostname, username and password for my hosted database.



========================================================

install.php code is:

<HTML>
<HEAD>
 <TITLE>X-Changer Installation Script</TITLE>
 <LINK REL="stylesheet" TYPE="text/css" HREF="MojStil.css">
</HEAD>
<BODY>

<?
extract ($HTTP_POST_VARS, EXTR_PREFIX_SAME,"wddx");
extract ($HTTP_GET_VARS, EXTR_PREFIX_SAME,"wddx");
if(empty($action))
{
?>
 <TABLE CLASS=MojText>
  <TR>
   <TD>
    <FORM ACTION="<?echo $PHP_SELF;?>" METHOD="POST">
     Server:<BR>
     <INPUT TYPE="text" NAME="db_server" value="localhost" SIZE=40><BR>
     Username:<BR>
     <INPUT TYPE="text" NAME="db_uname" value="" SIZE=40><BR>
     Password:<BR>
     <INPUT TYPE="password" NAME="db_pass" value="" SIZE=40><BR>
     Database Name:<BR>
     <INPUT TYPE="text" NAME="db_name" value="xchanger" SIZE=40><BR>
     <INPUT TYPE="hidden" NAME="action" value="step2" SIZE=40><BR>
     <INPUT TYPE="Submit">
    </FORM>
     FILE <B>db.inc.php</B> MUST HAVE PERMISSION SET TO MODE 666 !!!<BR>
   </TD>
  </TR>
 </TABLE>
<?
}
?>

<?
if($action == "step2")
{
 $link = mysql_connect($db_server, $db_uname, $db_pass) or die("Could not connect");

 if(!mysql_select_db($db_name))
 {
  mysql_create_db("$db_name");
  mysql_select_db($db_name);
 }
 
?>
 <TABLE CLASS=MojText>
  <TR>
   <TD>
    <FORM ACTION="<?echo $PHP_SELF;?>" METHOD="POST">
     Rates table name:<BR>
     <INPUT TYPE="text" NAME="db_rates" value="rates" SIZE=40><BR>
     Updates table name:<BR>
     <INPUT TYPE="text" NAME="db_updates" value="updates" SIZE=40><BR>
     <BR>
     Interval for updating rates [min](it should be at least 120 min):<BR>
     <INPUT TYPE="text" NAME="interval" value="120" SIZE=40><BR>
     <BR>
     <INPUT TYPE="hidden" NAME="action" value="step3" SIZE=40>
     <INPUT TYPE="hidden" NAME="db_server" value="<?echo $db_server;?>">
     <INPUT TYPE="hidden" NAME="db_uname" value="<?echo $db_uname;?>">
     <INPUT TYPE="hidden" NAME="db_pass" value="<?echo $db_pass;?>" >
     <INPUT TYPE="hidden" NAME="db_name" value="<?echo $db_name;?>">

     <INPUT TYPE="Submit">
    </FORM>
   </TD>
  </TR>
 </TABLE>
<?
 mysql_close($link);
}
?>

<?
if($action == "step3")
{
 $link = mysql_connect($db_server, $db_uname, $db_pass) or die("Could not connect");
 mysql_select_db($db_name);
 echo "Creating Tables:<BR>";
 echo "$db_rates ...<BR>";
 mysql_query("CREATE TABLE $db_rates (id int(11) NOT NULL auto_increment,ime tinytext NOT NULL,valuta tinytext NOT NULL,  vrednost float(8,2) NOT NULL default '0.00',sifra tinytext NOT NULL,KEY id (id)) TYPE=MyISAM;");
 echo mysql_error()."<BR>";
 echo "$db_updates ...<BR>";
 mysql_query("CREATE TABLE $db_updates (last_update datetime default NULL) TYPE=MyISAM;");
 echo mysql_error()."<BR>";

 mysql_query("DELETE FROM $db_rates;");

 echo "<BR>Filling Data into Tables:<BR>";
 mysql_query("INSERT INTO $db_rates VALUES (1, 'United States', 'U.S. Dollar', '1.00', 'U.S. Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (2, 'Argentina', 'Argentinian Peso', '3.61', 'Argentine Peso ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (3, 'Australia', 'Australian Dollar ', '1.77', 'Australian Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (4, 'Bahamas', 'Bahamian Dollar ', '1.00', 'Bahamian Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (5, 'Brazil', 'Brazilian Real ', '2.69', 'Brazilian Real ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (6, 'Chile', 'Chilean Peso ', '675.46', 'Chilean Peso ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (7, 'China', 'Chinese Renminbi ', '8.28', 'Chinese Renminbi ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (8, 'Colombia', 'Colombian Peso ', '2397.20', 'Colombian Peso ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (9, 'Croatia', 'Croatian Kuna', '7.66', 'Croatian Kuna ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (10, 'Czech. Republic', 'Czech. Republic Koruna ', '31.89', 'Czech. Republic Koruna ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (11, 'Denmark', 'Danish Krone ', '7.79', 'Danish Krone ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (12, 'European Union', 'EURO', '1.05', 'European Monetary Union EURO');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (13, 'Fiji', 'Fiji Dollar ', '2.12', 'Fiji Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (14, 'Ghana', 'Ghanaian Cedi ', '7945.36', 'Ghanaian Cedi ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (15, 'Honduras', 'Honduran Lempira ', '16.40', 'Honduran Lempira ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (16, 'Hong Kong', 'Hong Kong Dollar', '7.80', 'Hong Kong Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (17, 'Hungary', 'Hungarian Forint ', '254.69', 'Hungarian Forint ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (18, 'Iceland', 'Icelandic Krona ', '89.30', 'Icelandic Krona ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (19, 'India', 'Indian Rupee', '48.89', 'Indian Rupee ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (20, 'Indonesia', 'Indonesian Rupiah ', '8611.17', 'Indonesian Rupiah ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (21, 'Israel', 'Israeli New Shekel ', '4.96', 'Israeli New Shekel ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (22, 'Japan', 'Japanese Yen', '124.06', 'Japanese Yen ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (23, 'Malaysia', 'Malaysian Ringgit ', '3.80', 'Malaysian Ringgit ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (24, 'Mexico', 'New Peso', '9.69', 'Mexican New Peso ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (25, 'Morocco', 'Moroccan Dirham ', '10.94', 'Moroccan Dirham ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (26, 'Myanmar (Burma) ', 'Myanmar Kyat ', '6.54', 'Myanmar (Burma) Kyat ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (27, 'N. Antilles', 'Neth. Antilles Guilder ', '1.78', 'Neth. Antilles Guilder ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (28, 'New Zealand', 'New Zealand Dollar', '2.05', 'New Zealand Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (29, 'Norway', 'Norwege Krone', '7.72', 'Norwegian Krone ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (30, 'Pakistan', 'Pakistan Rupee ', '60.12', 'Pakistan Rupee ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (31, 'Panama', 'Panamanian Balboa ', '1.00', 'Panamanian Balboa ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (32, 'Peru', 'Peruvian New Sol', '3.47', 'Peruvian New Sol ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (33, 'Philippine', 'Philippine Peso ', '50.03', 'Philippine Peso ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (34, 'Poland', 'Polish Zloty', '4.02', 'Polish Zloty ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (35, 'Russian', 'Russian Rouble', '31.45', 'Russian Rouble ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (36, 'Singapore', 'Singapore Dollar ', '1.79', 'Singapore Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (37, 'Slovakia', 'Koruna', '46.46', 'Slovak Koruna ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (38, 'Slovenia', 'Slovenian Tolar', '237.03', 'Slovenian Tolar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (39, 'South Africa', 'South African Rand', '10.25', 'South African Rand ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (40, 'South Korea', 'South Korean Won', '1230.17', 'South Korean Won ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (41, 'Sri Lanka', 'Sri Lanka Rupee ', '96.22', 'Sri Lanka Rupee ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (42, 'Sweden', 'Swedish Krona', '9.50', 'Swedish Krona ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (43, 'Switzerland', 'Swiss Franc', '1.54', 'Swiss Franc ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (44, 'Taiwan', 'Taiwanese New Dollar ', '33.95', 'Taiwanese New Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (45, 'Thailand', 'Thailand Thai Baht ', '42.11', 'Thai Baht ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (46, 'Trinidad & Tobago', 'Trinidad & Tobago Dollar', '6.11', 'Trinidad & Tobago Dollar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (47, 'Tunisia', 'Tunisisan Dinar', '1.42', 'Tunisian Dinar ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (48, 'Turkey', 'Turkish Lira', '154.50', 'Turkish Lira (2) ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (49, 'Great Britain', 'Pound Sterling ', '0.67', 'Pound Sterling ');");
 echo ".";
 mysql_query("INSERT INTO $db_rates VALUES (50, 'Venezuela', 'Bolivar ', '1250.12', 'Venezuelan Bolivar ');");
 echo ".";
 mysql_query("INSERT INTO $db_updates VALUES ('2002-06-20 09:00:00');");
 echo ".<BR>Done.<BR>";


 $fp = fopen("db.inc.php","w");
 fwrite($fp,"<?\n");
 fwrite($fp,"\$db_server  = \"$db_server\";\n");
 fwrite($fp,"\$db_uname   = \"$db_uname\";\n");
 fwrite($fp,"\$db_pass    = \"$db_pass\";\n");
 fwrite($fp,"\$db_name    = \"$db_name\";\n");
 fwrite($fp,"\$db_rates   = \"$db_rates\";\n");
 fwrite($fp,"\$db_updates = \"$db_updates\";\n");
 fwrite($fp,"\$interval   = \"$interval\";\n");

 fwrite($fp,"?>");
 fclose($fp);

 mysql_close($link);
}
?>

</BODY>
</HTML>
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7181806
Okie,

See when you run the script without any parameters,

i mean when you just call the script from browser,

it shall ask you db host, user name and password. Enter the values which you get and you shall be through !!!

JD
0
 
LVL 8

Expert Comment

by:GEM100
ID: 7181870
Yep...
0
 

Author Comment

by:bankle
ID: 7184324
Do you mean this link:

http://auntypizza.port5.com/calc/install.php

???????

There is still an error message at the top:

"Warning: Wrong datatype in call to extract() in /host/a/u/n/p/o/r/auntypizza.port5.com/calc/install.php on line 9"

I don;t know anything about PHP so can you be more clear.

Thanks
0
 
LVL 5

Expert Comment

by:dkjariwala
ID: 7185194
Which version of PHP you are using ?

Put followin code in test.php and and tell me the version.


<?php

//test.php

phpinfo();

?>

Seems like $HTTP_GET_VARS are not available in the version of PHP you are using.

JD
0
 

Author Comment

by:bankle
ID: 7200233
I made a test.php page - it is version 4.

Here is URL to test.php

http://auntypizza.port5.com/calc/test.php
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8492231
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question