Пример #1
0
 public function testGetContent()
 {
     $html = "<html><head><title<>?>rand</title></head><body><script src=''>sad</script><style>sad</style>hello<a>another thing</a></body></html>";
     file_put_contents("./test.html", $html);
     $webFilter = new WebPageFilter("./test.html");
     $content = $webFilter->getContent();
     $this->assertEquals("helloanother thing", $content);
 }
Пример #2
0
<?php

require_once __DIR__ . "/WebPageFilter.php";
$content = "";
if (isset($_POST['url'])) {
    $webFilter = new WebPageFilter($_POST['url']);
    $content = $webFilter->getContent();
}
?>
<html>
	<body>
		<form method="post" action="">
			<input type="text" name="url" value="<?php 
echo $_POST['url'];
?>
">
			<input type="submit">
		</form>
		<hr/>
		<?php 
echo $content;
?>
	</body>
</html>