【发布时间】:2016-09-11 05:16:41
【问题描述】:
让用户在表单文本框中输入一个值,该文本框获取该值并将其放入 $html = file_get_html(' ') 并在页面上回显输出值。
<form action="dex.php" method="POST">
<b>Site:</b><input type="text" name="site" />
<input type="submit" name="submit" value="Search" />
</form>
<?php
include('simple_html_dom.php');
$html = str_get_html('site');
echo htmlspecialchars($_POST['site']);
$html->find('div', 1)->class = 'bar';
$html->find('div[id=site]', 0)->innertext = 'foo';
//echo $html; here doesn't show webpage just results
$html = file_get_html('http://www.myrobotbuddy.com');
//$html - file_get_html(' '); from form input
echo file_get_html('$html')->plaintext;
echo $html; //shows website also
?>
【问题讨论】:
-
你的问题不清楚,也没有告诉你要做什么
标签: php html forms file scraper