Is it possible to get HTML of an iframe (please note that iframe is refering to a webpage that loads via ajax call) from the page where I am loading it via ajax call using jquery?
Actualy I want to scrap the content of this website.
The issue is that this website loads via ajax. So I can not use curl for getting contents of a web page that require javascript to load.
For the solution of this issue I am calling a php file with ajax from index.php and passing my query q=blog to the php page that returns this iframe to index.php
<iframe id="myframe" src="https://blekko.com/#?q=blog" width="100%" height="100%"></iframe>
After successful ajax response I am saving the response of ajax that is an iframe refering to the website along with query in a div in index.php
<div id="myhtml" style="display:none"></div>
After 3 to 6 seconds contents of this website load in the iframe of index.php I have a jquery function in index.php that checks html of div id "myhtml" after 5 seconds of interval
<javascript>
var newInt = setInterval(function(){ check(); }, 5000);
function check(){
blekko_html = $("#myframe").contents().find("html").html();
alert(blekko_html);
}
</javascript>
But each time when check() function calls, it returns / alert this
<iframe id="myframe" src="https://blekko.com/#?q=blog" width="100%" height="100%"></iframe>
Even if the iframe is loaded with the content of webpage it always returns above iframe's html initialization, not the html of the webpage inside it.
Is it possible to get the html of iframe that is loading via ajax call and that iframe is containing a webpage that loads via ajax call?
if I able to get the html of that iframe then I will send it again to a php page using ajax were I can do scraping and fetch required data.