Advertisement
Guest User

Untitled

a guest
Jun 9th, 2012
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * ----------------------------------------------------------------------------
  5. * "THE BEER-WARE LICENSE" (Revision 42):
  6. * <daniel.winterfeldt@gmail.com>
  7. * wrote this file. As long as you retain this notice you
  8. * can do whatever you want with this stuff. If we meet some day, and you think
  9. * this stuff is worth it, you can buy me a beer in return Daniel Winterfeldt
  10. * ----------------------------------------------------------------------------
  11. */
  12.  
  13. require_once 'goutte.phar';
  14.  
  15. use Goutte\Client;
  16.  
  17. $version = array();
  18. $version['nginx_current'] = '1.2.1';
  19. $version['php_current'] = '5.4.3';
  20. $version['mariadb_current'] = '5.5.24';
  21. $version['xdebug_current'] = '2.2.0';
  22. $version['apc_current'] = '3.1.10';
  23. $version['phpmyadmin_current'] = '3.4.9';
  24. $version['adminer_current'] = '3.3.4';
  25.  
  26. $client = new Client();
  27. $crawler = $client->request('GET', 'http://www.nginx.org/download/');
  28.  
  29. $nginx_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  30. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  31. if ($version['nginx_current'] <= $matches[0]) {
  32. return $matches[0];
  33. }
  34. }
  35. });
  36.  
  37. foreach ($nginx_latest as $key => $value) {
  38. if ($value != null) {
  39. $version['nginx_latest'] = $value;
  40. }
  41. }
  42.  
  43. $crawler = $client->request('GET', 'http://windows.php.net/downloads/releases/');
  44.  
  45. $php_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  46. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  47. if ($version['php_current'] <= $matches[0]) {
  48. return $matches[0];
  49. }
  50. }
  51. });
  52.  
  53. foreach ($php_latest as $key => $value) {
  54. if ($value != null) {
  55. $version['php_latest'] = $value;
  56. }
  57. }
  58.  
  59. $crawler = $client->request('GET', 'http://downloads.mariadb.org/MariaDB/+files/');
  60.  
  61. $mariadb_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  62. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  63. if ($version['mariadb_current'] <= $matches[0]) {
  64. return $matches[0];
  65. }
  66. }
  67. });
  68.  
  69. foreach ($mariadb_latest as $key => $value) {
  70. if ($value != null) {
  71. $version['mariadb_latest'] = $value;
  72. }
  73. }
  74.  
  75. $crawler = $client->request('GET', 'http://xdebug.org/files/');
  76.  
  77. $xdebug_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  78. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  79. if ($version['xdebug_current'] <= $matches[0]) {
  80. return $matches[0];
  81. }
  82. }
  83. });
  84.  
  85. foreach ($xdebug_latest as $key => $value) {
  86. if ($value != null) {
  87. $version['xdebug_latest'] = $value;
  88. }
  89. }
  90.  
  91. /*$crawler = $client->request('GET', 'http://downloads.php.net/pierre/');
  92.  
  93. $apc_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  94. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  95. if ($version['apc_current'] <= $matches[0]) {
  96. return $matches[0];
  97. }
  98. }
  99. });
  100.  
  101. foreach ($apc_latest as $key => $value) {
  102. if ($value != null) {
  103. $version['apc_latest'] = $value;
  104. }
  105. }*/
  106.  
  107. $crawler = $client->request('GET', 'http://www.phpmyadmin.net/home_page/downloads.php');
  108.  
  109. $phpmyadmin_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  110. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  111. if ($version['phpmyadmin_current'] <= $matches[0]) {
  112. return $matches[0];
  113. }
  114. }
  115. });
  116.  
  117. foreach ($phpmyadmin_latest as $key => $value) {
  118. if ($value != null) {
  119. $version['phpmyadmin_latest'] = $value;
  120. }
  121. }
  122.  
  123. $crawler = $client->request('GET', 'http://www.adminer.org/#download');
  124.  
  125. $adminer_latest = $crawler->filter('a')->each(function ($node, $i) use ($version) {
  126. if(preg_match("#(\d+\.\d+(\.\d+)*)#", $node->nodeValue, $matches)) {
  127. if ($version['adminer_current'] <= $matches[0]) {
  128. return $matches[0];
  129. }
  130. }
  131. });
  132.  
  133. foreach ($adminer_latest as $key => $value) {
  134. if ($value != null) {
  135. $version['adminer_latest'] = $value;
  136. }
  137. }
  138.  
  139. ?>
  140.  
  141. <table>
  142. <thead>application</thead><thead>current version</thead><thead>latest version</thead>
  143. <tr>
  144. <td>nginx</td><td><?php echo $version['nginx_current'] ?></td><td><?php echo $version['nginx_latest'] ?></td>
  145. </tr>
  146. <tr>
  147. <td>php</td><td><?php echo $version['php_current'] ?></td><td><?php echo $version['php_latest'] ?></td>
  148. </tr>
  149. <tr>
  150. <td>mariadb</td><td><?php echo $version['mariadb_current'] ?></td><td><?php echo $version['mariadb_latest'] ?></td>
  151. </tr>
  152. <tr>
  153. <td>xdebug</td><td><?php echo $version['xdebug_current'] ?></td><td><?php echo $version['xdebug_latest'] ?></td>
  154. </tr>
  155. <tr>
  156. <td>apc</td><td><?php //echo $version['apc_current'] ?></td><td><?php //echo $version['apc_latest'] ?></td>
  157. </tr>
  158. <tr>
  159. <td>phpmyadmin</td><td><?php echo $version['phpmyadmin_current'] ?></td><td><?php echo $version['phpmyadmin_latest'] ?></td>
  160. </tr>
  161. <tr>
  162. <td>adminer</td><td><?php echo $version['adminer_current'] ?></td><td><?php echo $version['adminer_latest'] ?></td>
  163. </tr>
  164. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement