How can I read from a website? C# [duplicate]

落爺英雄遲暮 提交于 2019-12-14 03:33:42

问题


I'm trying to make a bot, how can I read the value like the 1800 / 1800 from a website?

        Console.WriteLine("Health: ")
        Console.WriteLine("Energy: ")
        Console.WriteLine("Cash: ")
        Console.WriteLine("Level: ")

I'm making a console application, trying to get the value. Like if the health is lower then 1000/1800 then it's going to execute a send key. Like send the key "0" to the website.

Thanks, Prince


回答1:


trying using WebClient.DownloadString

http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadstring(v=vs.110).aspx

WebClient client = new WebClient ();
string reply = client.DownloadString ("http://google.com");

you then parse the document for the things you want. you can use the HTML Agility pack for that

http://html-agility-pack.net



来源:https://stackoverflow.com/questions/21766408/how-can-i-read-from-a-website-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!