i want to use just the result of any online currency converter as a variable in to my program.
double amount_d;
amount_d=[amount doubleValue];
NSString *mar=[NSString stringWithFormat:@"http://www.xe.com/ucc/convert.cgi? Amount=%d&From=%@&To=%@",amount_d,code1,code2 ];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:mar]];
it opens like http://www.xe.com/ucc/convert.cgi?Amount=1&From=EUR&a开发者_JAVA技巧mp;To=USD
but i want to get only the result not the page, i don't have any idea about that & i'm beginner in objective c . or how can i get the currency rate table and use it in my program.
thanks.
They would need to provide you with an API to get the results only. What you (try to) do is a simple request, as any browser would do it and thus the get HTML code returned.
Moreover, according to their licensing page it seems you are only allowed to use their web snippet for free (or pay for licensing). You should look into their 'Advanced Converter Customization'.
Here is something you might want to consider instead: http://www.exchangerate-api.com/
精彩评论