tags:

views:

39

answers:

1

what i want to try to do is be able to enter say a url onto a variable and once executed the page will scrape all input field names and export it to a text file.

for example.

if i have

<input type="text" name="firstname">
<input type="text" name="lastname">
<select name="sex">
<option>...</option>
...
</select>

the output would be

firstname
lastname
sex

whats a simple way of doing it?

thanks

+2  A: 

Check out Simple HTML DOM. It would let you do something like this:

$html = file_get_html($my_address);
foreach($html->find('input, select, textarea') as $input) {
    $names[] = $input->name;
}
file_put_contents('my_output.txt', implode("\n", $names));
Paolo Bergantino