Output contents of an element with a specific class name

22 views
Skip to first unread message

Jonathan

unread,
Aug 31, 2010, 1:06:41 PM8/31/10
to phpQuery
I want to input an html document manually and then have just the
content of certain element output back to me.

This is what my php looks like.

<?php
require('phpquery/phpQuery.php');
phpQuery::$debug = 1;

$html = $_POST['fullHTML'];

$doc = phpQuery::newDocument($html);

print $doc->find('ul.benefits');

?>

And what I get back is the following:

string(30) "Loading HTML, isXML() == false" string(275) "Full markup
load (HTML):
Array
(
[0] => FIND
[1] => ul.benefits
[2] => Array
(
[0] => Array
(
[0] =>
[1] => ul
[2] => .benefits
)

)

)
XPATH: //ul[@class]
QUERY FETCHED
Found: ul.\"benefits\", comparing with matchClasses()
Found: ul.\"benefits, comparing with matchClasses()
Found: ul.\"free\", comparing with matchClasses()
Matched 0:
string(65) "Getting markup, moving selected nodes (0) to new
DocumentFragment" string(232) "Full markup load (HTML): " string(16)
"DOC: UTF-8 REQ: " string(48) "Full markup load (HTML),
documentCreate('utf-8')" string(27) "Importing nodes to document"
string(24) "documentFragmentToMarkup" string(49) "Getting markup
(HTML), final with charset 'utf-8'" string(220) "Markup: " string(26)
"documentFragmentToMarkup: " string(8) "Markup: "

Am I doing something wrong?
Reply all
Reply to author
Forward
0 new messages