USING GOOGLE API

Hello

I created a new page withing the framework, and on the page im trying to add a currency converter. I was able to find some code to help create that converter using google api. The code came with two php files, one named ajax_converter.php and the other named booking.php. Everything is handled in the booking.php and includes a javascript in which it calls the ajax_converter. But when running the converter it is just un-responsive. I would like to know if there is anyone who could help me with debugging the code to get the converter to work.

Below is the "booking.php"

<script type="text/javascript">

$(document).ready(function() {

&#036;('#convert').click(function(){


 


 //Get all the values


 var amount = &#036;('#amount').val();


 var from = &#036;('#fromCurrency').val();


 var to = &#036;('#toCurrency').val();


 


 //Make data string


 var dataString = &quot;amount=&quot; + amount + &quot;&amp;from=&quot; + from + &quot;&amp;to=&quot; + to;


 


	 &#036;.ajax({


	   type: &quot;POST&quot;,


	   url: &quot;ajax_converter.php&quot;,


	   data: dataString,


	   success: function(data){


		 //Show results div


		 &#036;('#results').show();


		


		//Put received response into result div


		 &#036;('#results').html(data);


	   }


	 });


});

});

</script>

</head>

<body>

<div id="currencyBox">

&lt;div class=&quot;data&quot;&gt;


    &lt;label for=&quot;amount&quot;&gt;Convert this amount:&lt;/label&gt;


    &lt;input type=&quot;text&quot; name=&quot;amount&quot; id=&quot;amount&quot; value=&quot;1&quot; /&gt;


&lt;/div&gt;





&lt;div class=&quot;data&quot;&gt;


    &lt;label for=&quot;fromCurrency&quot;&gt;From this currency:&lt;/label&gt;


    &lt;select name=&quot;fromCurrency&quot; id=&quot;fromCurrency&quot;&gt;


      


    &lt;/select&gt;


&lt;/div&gt;





&lt;div class=&quot;data&quot;&gt;


    &lt;label for=&quot;toCurrency&quot;&gt;To this currency:&lt;/label&gt;


    &lt;select name=&quot;toCurrency&quot; id=&quot;toCurrency&quot;&gt;


	  


    &lt;/select&gt;


&lt;/div&gt;





&lt;div class=&quot;data&quot;&gt;


	&lt;input type=&quot;button&quot; name=&quot;convert&quot; id=&quot;convert&quot; value=&quot;Convert&quot; /&gt;


&lt;/div&gt;

</div>

<!-- Below conversion results will be displayed -->

<div id="results"></div>

</html>

Here is the ajax_converter.php

<?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;

?>