Using find with phpQuery

698 views Asked by At

I have just started using phpQuery, and the documentation isn't particularly good and not been able to find many examples on the web.

I simply wanted to pass some html into phpQuery and match a string.

ie.

$html = '<div>blah blah blah <a href=1.php>xssss</a></div>';

and from here I want to search $html for 1.php if found I should return some text like "found it"

I tried this but it doesn't work:

  $doc = phpQuery::newDocumentHTML($html);
if(pq($doc)->find('12.php')) {
   echo 'found it';  
}else{
   echo 'not found';
}

as the output on this is 'found it'.

Thanks in advance

0

There are 0 answers