Php Döviz Hesaplama Yardım
-
arkadaşlar sitem için google döviz çevirimi için bir kod var yanlız çalışmıyor.
çalışmayan kod
<?php
//Get Posted data
$amount = $_POST['amount'];
$from = $_POST['from'];
$to = $_POST['to'];
//make string to be put in API
$string = "1".$from."=?".$to;
//Call Google API
$google_url = "http://www.google.com/ig/calculator?hl=en&q=".$string;
//Get and Store API results into a variable
$result = file_get_contents($google_url);
//Explode result to convert into an array
$result = explode('"', $result);
################################
# Right Hand Side
################################
$converted_amount = explode(' ', $result[3]);
$conversion = $converted_amount[0];
$conversion = $conversion * $amount;
$conversion = round($conversion, 2);
//Get text for converted currency
$rhs_text = ucwords(str_replace($converted_amount[0],"",$result[3]));
//Make right hand side string
$rhs = $conversion.$rhs_text;
################################
# Left Hand Side
################################
$google_lhs = explode(' ', $result[1]);
$from_amount = $google_lhs[0];
//Get text for converted from currency
$from_text = ucwords(str_replace($from_amount,"",$result[1]));
//Make left hand side string
$lhs = $amount." ".$from_text;
################################
# Make the result
################################
echo $lhs." = ".$rhs;exit;
?>
bu kodu çalışır hale getirebilirmiyiz ?
birtane buldum fakat uyarlayamadım
çalışıp çalışmadığını bilmediğim kod
01- $from = 'EUR';
02- $to = 'TRY';
03- $guntarih = date('d.m.Y H:i:s');
04- $amount = '1'
05- $string = $amount.'&from='.$from.'&to='.$to;
06- $google_url = 'http://www.google.com/finance/converter?a='.$string;
07- $result = file_get_contents($google_url);
08- $result = explode('<span class=bld>', $result);
09- $converted_amount = explode(' ', $result[1]);
10- $conversion = $converted_amount[0];
11- echo $conversion;ilk vbaşta verdiğim kodu çalışır hale getirebilmemiz mümkün mü ?
-
kodu çalıştırınca ne hata alıyorsun ?
-
prokto bunu yazdı
kodu çalıştırınca ne hata alıyorsun ?
1000 Minimum-scale=1, Width=device-width = 0
-
http://codepaste.net/mrqxbn
Denemedim ama muhtemelen çalışırlar. kodları kendine göre düzenler gelen döviz karşılığına göre işlemini yaparsın.
-
Parse error: syntax error, unexpected '<' in /home/.../public_html/ajax_converter.php on line 1 böyle bir hata aldım hocam -
http://sourceforge.net/projects/simplehtmldom/files/
Burdan simple_html_dom.php indir aynı klasöre at. GET ile değer gelmez ise hata mesajı verecektir ekrana onun için url nin sonuna ?tur=dolar veya ?tur=euro ekleyerek dene..
edit. syntax hatası vermiş kodlar ne şekilde paste ettiyysen ekran görünütüsnü de eklesene bir hocam
coder2 tarafından 04/Ara/15 16:06 tarihinde düzenlenmiştir