I'm trying to get the Url of an image, at the moment I have this code which does work but needs a webBrowser to do so.
public void getFileUrl(HtmlDocument htmlDocument)
{
HtmlElementCollection htmlCollectionImage = htmlDocument.Images;
foreach (HtmlElement htmlImage in htmlCollectionImage)
{
string Url = htmlImage.GetAttribute("src");
if (Url.StartsWith("http://www.exemple.com/"))
{
MessageBox.Show(Url);
}
}
}
I need to peace something up which doesn't require the webBrowser, but I really don't know how to do that.
Also instead of an HtmlDocument htmlDocument
being fed to the method, I need to feed it a simple string
.
Any alternative?