Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/10/2013, 22:17
wilsonlazo
 
Fecha de Ingreso: julio-2013
Mensajes: 60
Antigüedad: 10 años, 10 meses
Puntos: 0
convertir monto de soles a dolares

hola alguien me puede ayudar con esto:
tengo el siguiente problema la funcion me convierto
de soles a dolares y de dolares a soles para enviar el monto a paypal
PEN=USD
pero el problemas es q cuando el monto es mas de 2000 soles
el resultado me devuelve como $1
ojo:esto convertiendo de soles a dolares.
HELP.


Código PHP:

function  currency_paypal($from_Currency,$to_Currency,$amount) {
$amount urlencode($amount);
$from_Currency urlencode($from_Currency);
$to_Currency urlencode($to_Currency);
$url "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$ch curl_init();
$timeout 0;
 
curl_setopt ($chCURLOPT_URL$url);
 
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
 
curl_setopt($ch,  CURLOPT_USERAGENT "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
 
curl_setopt ($chCURLOPT_CONNECTTIMEOUT$timeout);
$rawdata curl_exec($ch);
 
curl_close($ch);
$data explode('"'$rawdata);
$data explode(' '$data['3']);
$var $data['0'];
return 
$var//number_format($var, 2, '.', '');