Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Threading.Tasks;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- namespace CryptoMain
- {
- public class BlockChain
- {
- private static string url = "https://blockchain.info/pt/ticker";
- private static JObject j;
- private string GetResponse(string uri)
- {
- WebClient navegador = new WebClient();
- return navegador.DownloadString(uri);
- }
- /// <summary>
- /// Use the following param: last, high, low
- /// </summary>
- /// <param name="node"></param>
- /// <returns></returns>
- public string GetDataByNode(string node)
- {
- j = JObject.Parse(GetResponse(url));
- try
- {
- return j["USD"][node].ToString();
- }
- catch (Exception )
- {
- return "ERR";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement