您的位置:首页 > 其它

黄金数据查询演示示例

2014-11-12 10:00 141 查看
黄金数据查询演示示例

using System;

using System.Text;

using System.Net;

namespace gold

{

class Program

{

static void Main(string[] args)

{

string key = "*****************";//申请的key值

string url = "http://apis.haoservice.com/lifeservice/gold/shgold?key="+ key;

WebClient wc = new WebClient();

wc.Encoding = Encoding.UTF8;

string str = wc.DownloadString(url);

Console.WriteLine(str);

Console.ReadKey();

}

}

}

URL:http://apis.haoservice.com/lifeservice/gold/shgold

支持格式:json

http请求方式:GET POST

DEMO:http://apis.haoservice.com/lifeservice/gold/shgold?key=您申请的APPKEY

返回示例:

{

"error_code":"0",

"reason":"Success!",

"result":[

{

"1":{

"variety":"Ag(T+D)",
/*品种*/

"latestpri":"6585.00",
/*最新价*/

"openpri":"6712.00",
/*开盘价*/

"maxpri":"6721.00",
/*最高价*/

"minpri":"6581.00",
/*最低价*/

"limit":"-1.98%",
/*涨跌幅*/

"yespri":"6718.00",
/*昨收价*/

"totalvol":"1564524.0000",
/*总成交量*/

"time":"2012-12-19 15:29:59"
/*更新时间*/

},

......

"7":{

"variety":"Au99.99",

"latestpri":"336.77",

"openpri":"342.00",

"maxpri":"342.00",

"minpri":"336.40",

"limit":"-1.53%",

"yespri":"342.00",

"totalvol":"6936.2000",

"time":"2012-12-19 15:29:53"

}

......

}

]

}

备注:

黄金数据查询,只用申请key值即可;

若出现错误,请查看该网页(http://www.haoservice.com/docs/22)上的代码表.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: