通过C ++访问网站并在窗口中显示其内容 [英] Accessing a website via C++ and show it's content in a window
本文介绍了通过C ++访问网站并在窗口中显示其内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我需要编写一个程序,以通过C ++访问网站并在控制台上显示一些内容.
与
Hello, I need to make a program that access a website via C++ and show some content on the console.
With
HEAD / HTTP/1.1
Host:
User-agent: Prova1
Connection: close
推荐答案
如果您在Windows上运行,则可以使用WinHttp-
If you''re running on Windows, you can use WinHttp - http://msdn.microsoft.com/en-us/library/windows/desktop/aa382925(v=vs.85).aspx[^]
首先尝试使用telnet进行操作.
下载腻子并使用相同的查询进行telnet.
first try what you are doing with telnet.
donwload putty and do the telnet with the same queries.
HEAD / HTTP/1.1
Host:
User-agent: Prova1
Connection: close
但是在上述顺序中,您的用户代理和连接将无法到达服务器,正确的语法将是一个小缺陷.
but in this above sequence there is a small flaws your user-agent and connection wont reach to server the correct syntax would be
HEAD / HTTP/1.1
Host: host_name
User-agent: Prova1
Connection: close
另一个问题是,如果您发送HEAD请求服务器,则只会回复标头信息.要获取内容,您需要发送GET请求.
another issue is if you send HEAD request server would be reply only with Header information. to get content you need to send GET request.
这篇关于通过C ++访问网站并在窗口中显示其内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文