Advertisement
hielasangre

Web Scraping - CPCICAT_BOT

Dec 15th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.   <style type="text/css">
  5.   body{
  6.         color: #FFF;
  7.         background-color: #000;
  8.         }
  9.    
  10.    
  11.   </style>
  12.   </head>
  13. <body>
  14. <title>Web Scraping - CPCICAT_BOT</title>
  15.  
  16.  
  17. <?php
  18. ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
  19. $cantidad_center = (int) $cantidad_center;
  20. $listado = "http://www.cpcicat.org.ar/listado-de-matriculados.html"; // URL de donde obtengo los nombres e ids de los matriculados.
  21. $cupones = "http://www.cpcicat.org.ar/scripts/pagos/cupon.php?socio="; // URL donde hare la consulta de lo que adeudan.
  22. $codigo_fuente_listado = file_get_contents($listado);
  23. $codigo_fuente_listado = utf8_decode($codigo_fuente_listado);
  24. $quito_tag_tbody = explode('<tbody>',$codigo_fuente_listado);
  25. $quito_tag_tbody = explode('</tbody>',$quito_tag_tbody[1]);
  26.  
  27. $ids_center = explode('<td style="text-align: center">', $quito_tag_tbody[0]);
  28. $cantidad_center = count($ids_center);
  29.  
  30. $explode_tds = explode('</td><td>',$quito_tag_tbody[0]);
  31. $i=1;
  32. for($x=1;$x<270;$x++)
  33.     {
  34.     ob_flush();
  35.     echo '<font color="#666">Nombre y Apellido:</font> '.$explode_tds[$x];
  36.     $explode_limpia = explode('</td><td style="text-align: center">',$explode_tds[$x+1]);
  37.     echo " ".$explode_limpia[0]." ";
  38.     $x = $x+1;
  39.     $adeuda = $cupones.$i;
  40.     $fuente_deuda = file_get_contents($adeuda);
  41.     $explodeo_deuda = explode('<form>',$fuente_deuda);
  42.     $explodeo_deuda = explode('<select name="users" onchange="mostrarMonto('.$i.', this.value)">',$explodeo_deuda[1]);
  43.     $explodeo_deuda = str_replace('Ud. adeuda','',$explodeo_deuda);
  44.     echo '<font color="#666">Adeuda: </font>'.$explodeo_deuda[0]."<br>";
  45.     $i++;
  46.     flush();
  47.     }
  48.    
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement