0

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

3
  • That's not css, you want something like a[href="12.php"] Commented Dec 2, 2014 at 4:31
  • Hi, thanks I have tried that previously (I prob. should have mentioned) but with out success. Commented Dec 2, 2014 at 14:35
  • Just read some documentation on css, that's all you need. Commented Dec 3, 2014 at 5:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.