Im scraping some websites and saving the data and then echo the data like this:
echo $html->save();
The $html
part is a variable which holds the complete website. I would like to echo the complete page in iframe, usually I would put a source src="file.php?url=http://somewebsite.com"
How do I echo the variable instead including the Iframe:
echo '<iframe src="$html->save()"></iframe>';
Is this somewhat how its done, or am I completely of?
Im using simple-html-dom and CURL like this:
require_once('simple_html_dom.php');
require_once('url_to_absolute.php');
$url = $_GET['url'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
$html = new simple_html_dom();
$html->load($curl_scraped_page, true, false);
foreach($html->find('a') as $a) {
$a->href = url_to_absolute($url, $a->href);
}
echo $html->save();
$html->clear();