Arkadaşlar
http://www.google.com/ig/calculator?hl=en&q=1USD=?TRY
Google ın döviz hesaplama hizmeti.
$adres = "http://www.google.com/ig/calculator?hl=en&q=1USD=?TRY";
$json = file_get_contents($adres);
$para = json_decode($json,true);
echo $para->rhs;
Bu yöntem ile veriyi çekmeye çalışıyorum beceremedim nerde hata acaba?
--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 22:00:55 -->-> Daha önceki mesaj 21:52:51 --
sorunu çözdüm arkadaşlar;
google json kodlarını
Alıntı
{lhs: "1 U.S. dollar",rhs: "1.87800128 Turkish liras",error: "",icc: true}
şeklinde veriyor ama olması gereken;
Alıntı
{"lhs": "1 U.S. dollar","rhs": "1.87800128 Turkish liras","error": "","icc": true}
budur. Bunuda
$forJSON = str_replace(array('lhs', 'rhs', 'error', 'icc'), array('"lhs"', '"rhs"', '"error"', '"icc"'), $json);ile çözüyorsunuz.
yalnız benim anlamadığım bu json tanımlamaları sabit değil mi? google neyin kafasını yaşıyor?
http://php.net/manual/en/function.json-decode.php