php currency converter script

Solutions on MaxInterview for php currency converter script by the best coders in the world

showing results for - "php currency converter script"
Irene
22 Feb 2020
1<?php
2  /////for current update currency using api/////
3  $curl = curl_init();
4curl_setopt_array($curl, array(
5  CURLOPT_URL => "https://api.exchangeratesapi.io/latest?base=USD",
6  CURLOPT_RETURNTRANSFER => true,
7  CURLOPT_ENCODING => "",
8  CURLOPT_MAXREDIRS => 10,
9  CURLOPT_TIMEOUT => 30,
10  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
11  CURLOPT_CUSTOMREQUEST => "GET",
12  CURLOPT_POSTFIELDS => "{\n\t\"QuantityOnHand\":1,\n\t\"ReOrderPoint\":1,\n\t\"QuantityAsOfDate\":\"2018-03-01\"\n}",
13  CURLOPT_HTTPHEADER => array(
14    "cache-control: no-cache",
15    "postman-token: f8326c98-2bb7-a466-6f5e-cb8bfc5421d0"
16  ),
17));
18
19$response = curl_exec($curl);
20$err = curl_error($curl);
21
22curl_close($curl);
23
24if ($err) {
25  echo "cURL Error #:" . $err;
26} else {
27 $response;
28  $response= json_decode($response,true);
29 $CAD= $response['rates']['CAD'];
30 $AUD= $response['rates']['AUD'];
31   
32   $GBP= $response['rates']['GBP'];
33  
34 
35
36
37
38  // echo"<pre>";
39  // print_r($response);
40  // echo"</pre>";
41 
42?>
Damián
19 Mar 2017
1<html>
2<head>
3<style>
4	#box
5	{
6		width:350px;
7		height:270px;
8		margin:0px auto;
9		border:2px solid black;
10	}
11	h2{
12		text-align: center;
13	}
14	table{
15		margin:0px auto;
16	}
17</style>
18</head>
19
20<body>
21
22<form align="center" action="currencyconvertor.php" method="post">
23
24<div id="box">
25<h2><center>Currency Converter</center></h2>
26<table>
27	<tr>
28	<td>
29		Enter Amount:<input type="text" name="amount"><br>
30	</td>
31</tr>
32<tr>
33<td>
34	<br><center>From:<select name='cur1'>
35	 <option value="AUD">Australian Dollar(AUD)</option>
36	 <option value="USD" selected>US Dollar(USD)</option>
37	 </select>
38</td>
39</tr>
40<tr>
41	<td>
42	<br><center>To:<select name='cur2'>
43	 <option value="INR" selected >Indian Rupee(INR)</option>
44	 <option value="JPY">Japanese Yen(JPY)</option>
45	 <option value="PHP">Philippine Peso(PHP)</option>
46	
47	</select>
48</td>
49</tr>
50<tr>
51<td><center><br>
52<input type='submit' name='submit' value="CovertNow"></center>
53</td>
54</tr>
55</table>
56</form>
57<?php
58if(isset($_POST['submit'])){
59	
60$amount = $_POST['amount'];
61$cur1 = $_POST['cur1'];
62$cur2 = $_POST['cur2'];
63
64if($cur1=="AUD" AND $cur2=="JPY"){
65echo "<center><b>Your Converted Amount is:</b><br></center>";
66echo "<center>" . $amount*82.463 . "</center>";
67}
68
69if($cur1=="AUD" AND $cur2=="INR"){
70echo "<center><b>Your Converted Amount is:</b><br></center>";
71echo "<center>" . $amount* 51.09 . "</center>";
72}
73
74if($cur1=="AUD" AND $cur2=="PHP"){
75echo "<center><b>Your Converted Amount is:</b><br></center>";
76echo "<center>" . $amount* 37.15 . "</center>";
77}
78
79if($cur1=="USD" AND $cur2=="JPY"){
80echo "<center><b>Your Converted Amount is:</b><br></center>";
81echo "<center>" . $amount* 109.49 . "</center>";
82}
83
84if($cur1=="USD" AND $cur2=="INR"){
85echo "<center><b>Your Converted Amount is:</b><br></center>";
86echo "<center>" . $amount* 67.83 . "</center>";
87}
88
89if($cur1=="USD" AND $cur2=="PHP"){
90echo "<center><b>Your Converted Amount is:</b><br></center>";
91echo "<center>" . $amount*49.32  . "</center>";
92}
93
94
95}
96
97?>
98
99</body>
100</html>
queries leading to this page
php convert to currency format phpconverting to any currency logic exchange rate phpwhat currency is phpphp currency convertercurrency converter with database in phpbest currency exchange script phpcurrency converter number phpchanging currency phpconvert euro to dollar in php languagephp convert currencyphp exchange money scriptmoney convertor in phpphp currency codecurrency converter script phpcurrency converter in phpphp php currency converterhow to change currency convert on phpphp to currencycurrency converter php source codeformat number to currency in phphow to convert currency symbol to currency code phphow to integrate currency in a php scriptconvert currency in phpconvert currency phpphp number to currencyformat currency phpcurrency convertor in phpget currency code by currency symbol phpstring to currency phpphp currency conversionphp currency numeric codecurrency converter function phpphp currency formatcurrency conversion in phpcurrency format dollar to number in phpconvert number in currency in phpcurrency symbol conversion phpphp convert currency to numbermoney exchange php scriptcurrency converter php codephp format number to currencyphp convert string to moneyphp to currency formatphp currency conversion formulacurrency converter in php source codecurrency phpphp get currency symbol from currency codephp currency converter codehoe to create currency exchange in phpphp free currency converterphp convert to currencyphp separate currencyphp currency conversion forumlafree currency converter phphow to create currency converter phpformat currency in phpphp currency formatorhow to create a currency converter in phpphp currency converter scriptautomatic currency conversion in phpconvert euro to dollar in php language c2 b4currency converter using php and sqlphp int to money formate currency exchange php script freeconvert number to currency format in phpcurrency converter phpcurrency converter in phpcurrency to number phpphp convert country code to currencycurrency converter in php demonumber format for currency in phpformat number to currency phpcreate currency converter in phpphp money converterset currency in phpmake value currency in phpdollar currency format phpbuild currency converter with phpcurrency convert in phphow to add currency converter in a php websitehow to format number into currency phpphp currencyphp currency converter script