Advertisement
Guest User

chess.php ELO test02

a guest
Nov 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. <form action="" method="get">
  2. <table align="CENTER" width="300">
  3. <tbody><tr class="alt">
  4. <td align="center">
  5. <p>Αναζήτηση συλλόγων, παικτών (* νέο)</p>
  6. </td>
  7. </tr>
  8. <tr class="">
  9. <td align="center">
  10. <p"><input type="text" name="q" maxlength="20" size="20"><br>
  11. <input type="submit" value="OK"></p"></td></tr>
  12. </tbody></table>
  13. <h1>result :
  14. <?php
  15. $player_id=$_REQUEST["q"];
  16. $url="https://chesstu.be/eso/player/".$player_id;
  17.  
  18. echo $url;
  19. echo "<hR>";
  20. //$homepage = file_get_contents($url);
  21.  
  22.  
  23. /*
  24. $homepage = file($url);
  25. // turn array into one variable
  26. $homepage=implode('',$homepage);
  27. */
  28.  
  29.  
  30. //$url='https://oscarliang.com';
  31. $ch=curl_init();
  32. $timeout=5;
  33.  
  34. curl_setopt($ch, CURLOPT_URL, $url);
  35. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  36. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  37.  
  38. // Get URL content
  39. $lines_string=curl_exec($ch);
  40. // close handle to release resources
  41. curl_close($ch);
  42. //output, you can also save it locally on the server
  43.  
  44. #<tag>(.*?)</tag>#g
  45.  
  46.     $pattern = "/<th>Παρτίδες<\/th>
  47.            <\/tr>
  48.                            <tr>
  49.                    <td>(.*?)                    <td>
  50.                        <a href=/s";
  51.     $pattern = "/th>(.*?)<a href=/s";
  52.  
  53.     //preg_match($pattern, $lines_string, $matches);
  54.    
  55. preg_match_all($pattern, $lines_string, $matches);
  56.  
  57. //echo $lines_string;
  58.  
  59. echo "<hr>matches : ";
  60. print_r ( $matches);
  61.  
  62.  
  63. #echo $homepage;
  64.  
  65.  
  66. ?>
  67. </h1>
  68. </form>
  69.  
  70.  
  71. <form action="https://chesstu.be/eso" method="get">
  72. <table align="CENTER" width="300">
  73. <tbody><tr class="alt">
  74. <td align="center">
  75. <p>Αναζήτηση συλλόγων, παικτών (* νέο)</p>
  76. </td>
  77. </tr>
  78. <tr class="">
  79. <td align="center">
  80. <p"><input type="text" name="q" maxlength="20" size="20"><br>
  81. <input type="submit" value="OK"></p"></td></tr>
  82. </tbody></table>
  83. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement