Skip to content

Instantly share code, notes, and snippets.

@technosophos
Created March 3, 2014 02:06
Show Gist options
  • Select an option

  • Save technosophos/9317295 to your computer and use it in GitHub Desktop.

Select an option

Save technosophos/9317295 to your computer and use it in GitHub Desktop.
QueryPath issue #133: Attempt to reproduce.
<?php
require_once "vendor/autoload.php";
$HTML = <<<EOL
<html>
<head>
<title>Foo</title>
</head>
<body>
<p>foo</p>
<ul id="one">
<li>One <p>Inner</p></li>
<li>Two</li>
<li>Three</li>
</ul>
</body>
</html>
EOL;
$qp = htmlqp($HTML);
print '==== HTML' . PHP_EOL;
print $qp->find('html')->html();
print PHP_EOL . '==== :eq(1)' . PHP_EOL;
print $qp->find('body li:eq(1)')->html();
print PHP_EOL . '==== :first' . PHP_EOL;
print $qp->find('body li:first')->html();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment