I am reading a webpage into a file. Then I want to display the contents that are between: "<form" and "</form>" while still including "<form" and "</form>".
I have tried this:
$url="http://www.webpage.com/submit.html";
$file = file($url);
if ($file) {
$lines_array = $file;
$lines_string = implode('', $lines_array);
}
else{
echo "<p>Unable to open remote file.<br>\n";
}
preg_match("/<form(.*)<\/form>/i", $lines_string, $match);
print $match[1];
Which doesn't work. The $lines_string variable is there and working, but when i use my attempt at matching, nothing happens. I've searched for a couple hours now and am sure it's some stupid mistake I'm making...
Help?
Or is there some code already written somewhere that can take a remote form and display all the inputs?