如果网站使用 SSL,如何使用 Webclient.DownloadFile 或 DownloadString?
我正在编写一个小实用程序,它会抓取网页并在我想要的课程有空位时向我发送电子邮件。请参阅以下网址:
但是,每次执行以下代码时都会出现错误:
private void timer1_Tick(object sender, EventArgs e)
{
using (WebClient client = new WebClient())
{
//var html = client.DownloadString("https://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US");
client.DownloadFile(@"https://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US", @"C:\file.txt");
}
}
有什么想法吗?
I'm writing a small utility that scrapes a webpage and emails me if the class I want has open seats. See the follow url:
However, I get an error everytime I execute the following code:
private void timer1_Tick(object sender, EventArgs e)
{
using (WebClient client = new WebClient())
{
//var html = client.DownloadString("https://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US");
client.DownloadFile(@"https://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US", @"C:\file.txt");
}
}
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您发布的该链接也支持简单的 HTTP。
请参阅此处:http://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US
尝试从网址中删除 s 并查看是否作品。
That link you posted also supports simple HTTP.
See here: http://grim.westga.edu/pls/UWGP_DAD/hwwkbull.p_us_subj_list?term_code=201108&subj=math&levl=US
Try removing your s from the url and see if that works.