Skip to content

Instantly share code, notes, and snippets.

@ogabrielsantos
Created April 6, 2019 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogabrielsantos/f020c1728d8fd9b06aefa8797e5d8ab2 to your computer and use it in GitHub Desktop.
Save ogabrielsantos/f020c1728d8fd9b06aefa8797e5d8ab2 to your computer and use it in GitHub Desktop.
<?php
$response = '<input type="hidden" autocomplete="off" name="timezone" value="180" id="u_0_9">';
preg_match_all('/name="(.*?)" value="(.*?)"/is', $response, $names);
print_r($names);
// Output: Array ( [0] => Array ( [0] => name="timezone" value="180" ) [1] => Array ( [0] => timezone ) [2] => Array ( [0] => 180 ) )
$response = '<input type="hidden" name="jazoest" value="2703" autocomplete="off">';
preg_match_all('/name="(.*?)" value="(.*?)"/is', $response, $names);
print_r($names);
// Output: Array ( [0] => Array ( [0] => name="jazoest" value="2703" ) [1] => Array ( [0] => jazoest ) [2] => Array ( [0] => 2703 ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment