This commit is contained in:
@@ -1794,6 +1794,7 @@ cJSON *send_curl(char *url,char *fname)
|
||||
{
|
||||
if ( (jsonstr= (char *)filestr((long *)&fsize,fname)) != 0 )
|
||||
{
|
||||
fprintf(stderr,"[%s]\n",jsonstr);
|
||||
json = cJSON_Parse(jsonstr);
|
||||
free(jsonstr);
|
||||
}
|
||||
@@ -1848,8 +1849,10 @@ uint32_t get_dailyfx()
|
||||
//{"base":"USD","rates":{"BGN":1.74344803,"NZD":1.471652701,"ILS":3.6329113924,"RUB":65.1997682296,"CAD":1.3430201462,"USD":1.0,"PHP":52.8641469068,"CHF":0.9970582992,"AUD":1.4129078267,"JPY":110.6792654662,"TRY":5.6523444464,"HKD":7.8499732573,"MYR":4.0824567659,"HRK":6.6232840078,"CZK":22.9862720628,"IDR":14267.4986628633,"DKK":6.6551078624,"NOK":8.6806917454,"HUF":285.131039401,"GBP":0.7626582278,"MXN":19.4183455161,"THB":31.8702085933,"ISK":122.5708682475,"ZAR":14.7033339276,"BRL":3.9750401141,"SGD":1.3573720806,"PLN":3.8286682118,"INR":69.33187734,"KRW":1139.1602781244,"RON":4.2423783206,"CNY":6.7387234801,"SEK":9.3385630237,"EUR":0.8914244963},"date":"2019-03-28"}
|
||||
char url[512],*datestr; cJSON *json,*rates; int32_t i,n; uint32_t datenum=0,price = 0;
|
||||
sprintf(url,"http://api.openrates.io/latest?base=USD");
|
||||
fprintf(stderr,"dailfx\n");
|
||||
if ( (json= send_curl(url,(char *)"dailyfx")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"(%s)\n",jprint(json,0));
|
||||
if ( (rates= jobj(json,(char *)"rates")) != 0 && (n= cJSON_GetArraySize(rates)) > 0 )
|
||||
{
|
||||
for (i=0; i<n; i++)
|
||||
@@ -1860,7 +1863,7 @@ uint32_t get_dailyfx()
|
||||
}
|
||||
if ( (datestr= jstr(json,(char *)"data")) != 0 )
|
||||
fprintf(stderr,"(%s)",datestr);
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr,"n.%d\n",n);
|
||||
free_json(json);
|
||||
}
|
||||
return(datenum);
|
||||
|
||||
Reference in New Issue
Block a user