0

I have the html line

<input type="hidden" name="64fe437df7ac92d258ecfc8b46970ffc" value="1" /></form>

And i want to get this 64fe437df7ac92d258ecfc8b46970ffc using preg_match

$url = "http://www.ugodambrosi.it/index.php?option=com_users&view=registration";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_exec($ch);
curl_close($ch);

preg_match("/<input type="hidden" name="(.*?)" value="1"/", $result, $matches);
print_r($matches);

But why the result is

 Parse error: syntax error, unexpected 'hidden' (T_STRING) in on line 10
yudi
  • 1

1 Answers1

0
preg_match("/<input type='hidden' name='(.*?)' value='1'/", $result, $matches);

The input field is not closing because of the double-quotes. You can change it to single quotes.

Amanjot Kaur
  • 2,028
  • 4
  • 18
  • 33
  • Why have you changed double quotes into single? The original input line has double quotes, (re)read the question. – Toto Oct 30 '19 at 12:42