Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML输入表单的PHP输出_Php_Html_Forms_File_Scraper - Fatal编程技术网

HTML输入表单的PHP输出

HTML输入表单的PHP输出,php,html,forms,file,scraper,Php,Html,Forms,File,Scraper,让用户在表单文本框中输入一个值,该文本框接受该值并将其放入$html=file\u get\u html(“”)中,并在页面上回显输出值 <form action="dex.php" method="POST"> <b>Site:</b><input type="text" name="site" /> <input type="submit" name="submit" value="Search" /> </form>

让用户在表单文本框中输入一个值,该文本框接受该值并将其放入$html=file\u get\u 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 
?>

地点:

我只是在猜测你想要实现什么,但是:

首先将表单输入到变量中:

if (isset($_POST['submit'])) {
    $site = htmlspecialchars($_POST['site']);
}
然后:


你的问题不清楚,也说不清你想干什么谢谢,我不知道该怎么问这个问题。只需让用户在输入框中输入http地址,然后发布爬网结果。感谢你至少给了我更多的机会,而不是那些似乎只想把每一个问题都打倒的众多仇恨者。谢谢你,斯托伊乔:)
if(isset($site)){
    $html = str_get_html($site);
}