-5

Have the user input a value in a form text box that takes the value and puts it in $html = file_get_html(' ') and echoes output value on the page.

<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 Answers1

0

I'm only guessing what you want to achieve, but:

First get the form input in to a variable:

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

then:

if(isset($site)){
    $html = str_get_html($site);
}
Stoycho Trenchev
  • 557
  • 4
  • 12
  • Thank you, I don't know how else to ask the question. Just have a user input an http address in an input box and then post the results from the crawl. Thanks for at least giving more of a chance than the numerous haters that seem to want to just shoot every question down. Thank you Stoycho :) – Danny Omega Sep 12 '16 at 05:11