title: javascript variable parsing by php regex
body: <p>I am trying to parse some javascript variables using PHP.</p>
  
  <p>Random website: (<strong>not my website</strong>) </p>
  
  <pre><code>//.... content ...
      function(response) {
          if (response) {
              var data = { id: "fka1q021", action: "post", date: "today" };
          }
          //.....
  </code></pre>
  
  <hr>
  
  <pre><code>$url = 'www.website.com';
  $content = htmlspecialchars(file_get_contents($url));
      preg_match_all('/var data = { id: "(.*?)", action: "post", date: "today" };/', $content, $matches);
      print_r($matches);
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <p>Array ( [0] => Array ( ) [1] => Array ( ) ) </p>
  
  <p>I want to get value of <strong>id</strong> which is <strong>fka1q021</strong> </p>
  
  <p>How can I get it? Thanks</p>