ter*_*ško 0 html javascript php c# http
我有一份文本文档,其中列出了超过2,50,000个网站URL.浏览每个URL,如果它将我重定向到特定的URL(不同的站点),我想将其保存到另一个文本文件.
我是C#开发人员,我知道如何读取或写入文件和小块,但寻找最佳逻辑或方式以任何编程语言执行上述任务和脚本.
string url = "http://www.google.com";
var req = (HttpWebRequest)HttpWebRequest.Create(url);
req.AllowAutoRedirect = false;
using (var resp = req.GetResponse())
{
var location = resp.Headers["Location"];
if (!String.IsNullOrEmpty(location))
{
Console.WriteLine("url is redirected to " + location);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |