fork download
  1. <?php
  2.  
  3. $data = <<<DATA
  4. <meta http-equiv='refresh' content='0; URL=/game/index.php?page=overview&session=9efae87dd67&lgn=1'>
  5. <body/>
  6. DATA;
  7.  
  8. $previous_value = libxml_use_internal_errors(TRUE);
  9.  
  10. $dom = new DOMDocument();
  11. $dom->loadHTML($data);
  12.  
  13. $xpath = new DOMXPath($dom);
  14.  
  15. $meta = $xpath->query("//meta")->item(0);
  16.  
  17. $regex = '~session=\K[^&]+~';
  18. preg_match($regex, $meta->getAttribute("content"), $session);
  19. echo $session[0];
  20.  
  21. libxml_use_internal_errors($previous_value);
  22.  
  23. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
9efae87dd67