I am trying to get all form elements on any page using curl. I can get the data no problem but I think the preg_match_all is all screwy because I don't get the results I want. Here is my code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.any-site-with-a-form-on-it.com/');
curl_setopt($ch, CURLOPT_HEADER, 0);
$data=curl_exec($ch);
curl_close($ch);
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'",$data,$elements);
$match = implode("\r\n",$elements[0]);
print $match;
I just get the whole page returned as the $match variable...any ideas?