Radim u C# pa sam iskoristio konponentu WebBrowser.
Source dobijem sa:
Code:
wbBrowser.DocumentText
wbBrowser.DocumentText
i to radi dobro, osim kada na stranici imam fremove (en. Frame) čij kod se neće prikazati :( .
Na sledećem linku se objašnjava kako pristupiti fremu
http://msdn.microsoft.com/en-u...s.forms.htmlwindow.frames.aspx
i u njemu postoji primjer:
Code:
private void GetLinksFromFrames()
{
Hashtable linksTable = new Hashtable();
string frameUrl;
if (!(webBrowser1.Document == null))
{
HtmlWindow currentWindow = webBrowser1.Document.Window;
if (currentWindow.Frames.Count > 0)
{
foreach (HtmlWindow frame in currentWindow.Frames)
{
frameUrl = frame.Url.ToString();
Hashtable frameLinksHash = new Hashtable();
linksTable.Add(frameUrl, frameLinksHash);
foreach (HtmlElement hrefElement in frame.Document.Links)
{
frameLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");
}
}
}
else
{
Hashtable docLinksHash = new Hashtable();
linksTable.Add(webBrowser1.Document.Url.ToString(), docLinksHash);
foreach (HtmlElement hrefElement in webBrowser1.Document.Links)
{
docLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");
}
}
}
}
private void GetLinksFromFrames()
{
Hashtable linksTable = new Hashtable();
string frameUrl;
if (!(webBrowser1.Document == null))
{
HtmlWindow currentWindow = webBrowser1.Document.Window;
if (currentWindow.Frames.Count > 0)
{
foreach (HtmlWindow frame in currentWindow.Frames)
{
frameUrl = frame.Url.ToString();
Hashtable frameLinksHash = new Hashtable();
linksTable.Add(frameUrl, frameLinksHash);
foreach (HtmlElement hrefElement in frame.Document.Links)
{
frameLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");
}
}
}
else
{
Hashtable docLinksHash = new Hashtable();
linksTable.Add(webBrowser1.Document.Url.ToString(), docLinksHash);
foreach (HtmlElement hrefElement in webBrowser1.Document.Links)
{
docLinksHash.Add(hrefElement.GetAttribute("HREF"), "Url");
}
}
}
}
Kada ja izvršavam sledeći kod meni "frame" tj. za svaki njegov property piše :
{"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"} System.Exception {System.UnauthorizedAccessException}
Kada kopiram link sa te stranice i odem na njegov url onda mi i "DocumentText" radi posao jer dobijem HTML source tog frema :)
Postoji li način da iz koda pristupim tom "Source"-u??? Kako???