Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




XML Currency Script


I have a table in my database that has 4 different currencies in it (I plan to add more when i have this xml update script done). This has 4 fields, 2 of which are code (eg USD, JPY) and multiplier (USD is taken as 1, and the rest are multiplied from there). Now, I would like to automatically update these currency multipliers using this xml data feed:

"http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"

The only problem is, i dont know where to start with it. Now if anyone could help me either create an array from this data (so i could use $cymulti['USD'] would equal the rate from the data feed that had the currency USD) or create individual variables such as $USD would equal the rate from the data feed for the currency USD).




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Currency
is there any places where i can get som
currency data for free with php ?

Currency
i want to build a script that create US dollar to Philippines Peso.
example:

its auto:  1 USD = "Auto" PHP peso

currency script for this.

Currency
How do I output currency, as the zero on the end of the following value gets cut off:

e.g. £0.50

How do I add a zero, if a zero is expected to appear at the end of the value?

Currency Formatting
i'm trying to format the output of a record in access, which i am
pulling from through php (odbc) and the formatting is set at 4 decimal
places, which i don't want. i want currency and no decimal places.
I was trying to use this example, but i have no bloody idea howo to use it.
or where to put it for that matter:

<?php

$number = 1234.56;

// let's print the international format for the en_US locale
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number)."
";
// USD 1,234.56

?>

Currency Symbols
I have a problem, we use a microsoft (mssql) product at work which stores currency symbols in the database.

Now when I retrieve these symbols from the database and try to echo them to the screen using php I just get a funny square box symbol instead of the actual currency symbol. Any idea on how I can get the symbols to show correctly?

Currency Rounding
I have the following output from a calculation: 211.5

I want to print this to screen as 211.50 (currency), but the round($value,2) doesn't force a rounding... is it possible?

Format Currency
I want to take a variable and make sure that I output to the browser in dollar format ie if I set $price=100. I want to make sure that $price appears as 100.00. in turn make sure that when $price=100.97 is outputted as 100.97

Format Currency With More Than 2 Decimals
I've tried to use both round and money_format but I can't seem to get what i what.

I have a shopping cart on my web site and I had the tax to the subtotal for calculating the total.

However the following problem arises when using round():
$13.2818
becomes $13.28 (should be $13.29)

$13.2772
becomes $13.28 (works fine)

Is there another function that will ALWAYS round up after X number of decimals?

Numeric Currency To Words
I have a program which calculates some transactions and giving the total as numbers. for eg. 1000.00. I want to display it in words also. Like (One thousand only)..

Clean Currency Input
I wrote the following function as a "cleaner" for a currency input:

function is_currency($v) {
//returns a string with only the numbers for a currency format
$v = str_replace("$", "", $v);
$regex = '/(?:([0-9]+)|.)/'
if(preg_match($regex, trim($v) ) ){
$v = $v + 0.00001;
if (is_float($v)) {
return round($v, 2);
}
}
else {
return 0;
}
}

I want users to be able to put in things like:
NZ$12.34
$12.34
12
12.3456
1,002.23
and it should always translate into a number with two decimals (e.g. 12.34
or 12.00)

I am sure that this is probably the clumsiest way ever to do this. How can
I improve this function?

PS despite numerous efforts I am still super weak on regular expressions. I
can only copy them and not write them myself.

Want Currency Converter In Php Code
i want to convert one country currency to another country currency in my shopping web site without redirecting to another site. can u suggest some idea to do this.

Authorised.NET + Multiple Currency
Has any one integrate Authorised.net with multiple Currency? Example : I want to make transaction for $10 . with different currency types.

Force 2 Decimal Places For Currency
How can I force a value to retain 2 decimal places (or atleast display them)? E.G. force $19.90 to be displayed as such, not $19.9

Language And Currency Changing Script ?
I am asking this on behalf of a friend who is - as I am - completely
ignorant of php. Almost.

He has CartWeaver shopping cart. The php version. He need to be able to
allow users to swap currency and language with a click, but still have
the cart connected to one single and the same data base.

He has been in touch with the developers, and their reply is that the
feature might be included in next version.

Question is: Can he in some way apply this in a way himself with some
link(s) to extra language and currency files? If so, how should it be
done? Are there any samples out there? (we have both searched the web
for a month - in vane).

How Do I Insert And Display Currency In PHP/MySQL?
I have a field in mysql which is a double and I trying to store say $5.00. I'm entering 5.00 but my select statements are returning 5, I need the .00 as well though.

Data Field With Currency Not Sorting Accurately
I have a datatable with a varchar field know as "price". At this time I have 3 rows in it; they are as follows: $ 18,500 $19,500 and $ 9,500. The problem is that when I try to sort in either ascending or descending order; it does not sort right. I know the problem lies in the $ 9,500, because I added a zero in front of the 9,500 (like this: $ 09,500) and it sorted fine. At first I thought it may have had something to do with the dollar sign, but it didn't because I removed and tested it without dollar sign and still had the same problem.

What I want to know is, how I can make datatable sort accurately with putting a zero in front of the 9,500. I tried to use a CSS style to cover up the zero, but when I did that, datatable still would not sort the right way. MySQL code in my web page is accurate, because you can take the $ 9,500 and add a 5 digit number and it works fine.

PAYPAL Problem :- Not Adding The Shipping Amount If Currency Is CHF

I have come up with a problem with PAYPAL integration in my project.
I have choosed the currency as CHF (swiss frank).

I have posted amount and shipping amont properly.

But When It is going to paypal. It is showing only amount ( its not including the shipping amount)

This problem do not occur if i choose currency as USD or CAD or any other.

I have attached the screen shots.

Displaying Currency Exchange Rates On A Page For Product Price
i want to display the price of a product on my site in multiple
currencies that is constantly updated to keep in line with exchange
rate fluctuations can anyone tell me how i could get access to basic
exchange rate data automatically for my site? (just a few major
currencies)


Copyright © 2005-08 www.BigResource.com, All rights reserved