Fetch html from iframe

c# html html-agility-pack iframe

Question

I am making an app in which I want to fetch some content from iframe, In iFrame code is like this.

<div class="abc">

<a class="abc" href="example.com" data-ctorig="example2.com" > **** </a>

</div>

I want the website "example2.com" for my app. I use ASP.NET(C#), HtmlAgilityPack.... How to do this?

I go to the "src" link of the iframe. But again I found nothing. I give you the link click here. Open this page, I want to parse given links. 1. How to Find True North Without a Compass: 2. How to Find True North Without a Compass.

Popular Answer

Point HtmlAgilityPack to the IFrame URL, not the Hosting page.

Clarified...

If I understand you correctly, you can fetch the HTML of the IFrame using a WebClient and HtmlAgilityPack.

First you need to use a WebClient to fetch the HTML of the host page. You'll then want to use HtmlAgilityPack to parse the host page HTML and extract the IFrame URL. Next you'll want to use another WebClient to get the HTML from the IFrame URL, and again, use HtmlAgilityPack to parse the response, which should give you what you're after.

Of course, your question is very vague, so I'm not entirely sure this is what you're after. Either way, the following links should help you.

HtmlAgilityPack Tutorial

Download HTML Using WebClient




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why