2016-09-11 33 views
-5

値を受け取り、それを$ html = file_get_html( '')に配置し、ページの出力値をエコーするフォームテキストボックスに値を入力させます。HTML入力のPHP出力フォーム

私はあなたが達成したいものを推測、しかしだ
<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 
?> 
+1

まず変数へのフォーム入力を取得:その後、

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

を質問は明確ではなく、あなたが何をしているのかを教えてください。 – xzegga

答えて

0

:あなたの

if(isset($site)){ 
    $html = str_get_html($site); 
} 
+0

ありがとう、私は他にどのように質問するのか分かりません。ユーザーに入力ボックスにhttpアドレスを入力させてから、クロールの結果を送信してください。少なくとも、すべての質問を撃墜したいと思っている多くの嫌悪者よりも、チャンスを与えてくれてありがとう。ありがとうStoycho :) –

関連する問題