Iphone dev : how can I get a result from google currency converter? -
sorry english ^^ know how can have result google converter tool currency, available on http://www.google.com/finance/converter?a=1&from=usd&to=gbp example.
i have tried :
-(ibaction)getresponse:(id) sender{ nsstring *myurlstring = @"http://www.google.com/finance/converter?a=1&from=usd&to=gbp"; nsurl *myurl = [nsurl urlwithstring: myurlstring]; nsdata *data = [nsdata alloc]; data=[nsdata datawithcontentsofurl:myurl]; if(data!=nil && data != ""){ nsstring *response = [[[nsstring alloc] initwithdata:data]] [label settext: response]; } else [label settext:@"not working"]; } but when click on button, label not have text (it empty). doing wrong ? possible want ? thank futures answers ! olivier.
yeah.. possible... see data getting html file or can treated xml. parse xml file , result. there ia lot of things in file have extract
<div id=currency_converter_result>1 usd = <span class=bld>0.6118 gbp</span> hey try url http://www.google.com/ig/calculator?hl=en&q=1usd=?inr
this url return json
{lhs: "1 u.s. dollar",rhs: "44.5097254 indian rupees",error: "",icc: true}
just parse it. :)
Comments
Post a Comment