Answer the question
In order to leave comments, you need to log in
I don't understand why the code is not working?
Getting the contents of the head tag using code
<?
$html = file_get_html('http://site.ru/');
foreach ($html->find("head") as $elements) {
$head = $elements;
}
echo $head;
?>
Answer the question
In order to leave comments, you need to log in
Because you're redefining $head every time, you need to add a dot before "equals". So with each iteration, you will add new data to the end
<?
$html = file_get_html('http://site.ru/');
foreach ($html->find("head") as $elements) {
$head .= $elements;
}
echo $head;
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question