所以我正在向特定网站发送 httpwebrequest,我需要来自该网站的图像,但是该图像在请求完成后 3-5 秒加载,因此源不包含图像,我想进行某种延迟所以我可以在几秒钟后得到响应,这是我的代码:
HttpWebRequest req1 = (HttpWebRequest)WebRequest.Create("url");
using(var httpResponse = req1.GetResponse())
{
using (var ResponseStream = httpResponse.GetResponseStream())
{
if (ResponseStream != null)
{
using (StreamReader sr = new StreamReader(ResponseStream))
{
string response = sr.ReadToEnd();
var doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(ResponseStream);
foreach(HtmlNode node in doc.DocumentNode.SelectNodes("src"))//it's not working because the source does not contain the image
{
pictureBox1.ImageLocation = node.ToString();
}
}
}
}
}