I am using QueryPath and I want to be able to get the raw content of a given selector.
I can't find in the docs anything other than ->text() to get contents. this gives me text so that the My l2 <a href="/alink">alink</a> becomes My l2 alink, but I want the a tag on my output.
How could i get the output My l2 <a href="/alink">alink</a> ?
I've writen some pseudo code below
$html = '<div class="col-sm-11 col-12 offset-sm-1 collapse">
<ul>
<li>
My li1
</li>
<li>
My l2 <a href="/alink">alink</a>
</li>
</ul>
</div>';
$dom = qp($html, "li");
foreach($dom as $key){
$key->text();
}
You should use
instead of text()