For learning purpose i am trying to write a simple currency converter. I want to get the updated rate from Google.
public void Google() throws IOException {
String url="https://www.google.com/finance/converter?a=1&from=USD&to=BDT";
URL theUrl=new URL(url);
URLConnection openUrl=theUrl.openConnection();
BufferedReader input = new BufferedReader(new InputStreamReader(openUrl.getInputStream()));
String result=null;
while ((result=input.readLine()) != null){
System.out.println(result);
}
input.close();
}
It gets me the html source:
<div id=currency_converter_result>1 USD = <span class=bld>77.9284 BDT</span>
So i only need the rate 77.9284 BDT and store it in a variable.
I am not getting any idea how to do it! Do i need somekind of regex?
Any help will be appreciated !