Was just wondering if any of you guys know how to get all iframes src from html code in php? Would help me a lot!
I have tried this so far:
$dom = new DOMDocument();
$html = $data;
@$dom->loadHTML($html);
$a = $dom->getElementsByTagName('iframe');
for ($i; $i < $a->length; $i++) {
$attr = $a->item($i)->getAttribute('src');
echo $attr . "\n";
}
This is the URL: http://www.youtube.com/all_comments?v=wb1u5CeMhkI
And then I want to get the iframe src in the 'comments-iframe-container' div. Search for the div, and the iframe will be 2 lines below the div.
Have a lovely christmas! :)