Beispiel #1
0
<div id="response"><pre><p>Please ensure you've supplied both xpath AND a url OR a full XML.</p></pre>
</div>
</div>
EOD;
    echo $html;
    exit;
}
include_once "class.Scraper.php";
$scraper = new Scraper();
if (!empty($_GET['url'])) {
    $scraper->setUpScraper($_GET['url'], $_GET['xpath']);
}
if (!empty($_GET['xml'])) {
    $xmlFromString = $scraper->getXMLFromString($_GET['xml']);
    $scraper->setPageXML($xmlFromString);
    $scraper->setXpath($_GET['xpath']);
}
$queryResponse = $scraper->getResponse();
$output = "";
$output .= <<<EOD
<h3>Results of xpath query</h3>
<p>Here's the result of the xpath query you ran. And as a bonus, the entire XML tree is <a href="#xml">below</a> too. </p>
EOD;
$output .= <<<EOD
<div id="container">
<div id="response">
<pre>
EOD;
$output .= print_r($queryResponse, true);
$output .= <<<EOD
</pre>