小雪3

图灵API

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("和我说点什么吧?");
            while (true)
            {
                string str= Console.ReadLine();
                string url = @"http://www.tuling123.com/openapi/api?key=**********&info="+str;
                HttpClient httpClient = new HttpClient();
                var response = httpClient.GetAsync(new Uri(url)).Result;
                string result = response.Content.ReadAsStringAsync().Result;
                date de = JsonConvert.DeserializeObject<date>(result);
                Console.WriteLine(de.text);
            }
        }
    }
    public class date
    {
        public int code { get; set; }
        public string text { get; set; }
    }
}

 

posted @ 2016-04-20 15:10  net小雪  阅读(278)  评论(0编辑  收藏  举报

小雪4