fork(5) download
  1. <?php
  2.  
  3. $html = '<html>
  4. <head>
  5. <title>pagina</title>
  6.  
  7. </head>
  8. <body>
  9.  
  10. <div class="listdoTexto">
  11. <ul>
  12. <li class="texto"><a href="textolink">texto1 qualquer</a></li>
  13. <li class="texto"><a href="textolink">texto2</a></li>
  14. <li class="texto"><a href="textolink">texto3</a></li>
  15. <li class="texto"><a href="textolink">texto4</a></li>
  16. </ul>
  17. </div>
  18.  
  19. <div class="listdoTexto2">
  20. <ul>
  21. <li class="texto"><a href="textolink">texto5</a></li>
  22. </ul>
  23. </div>
  24.  
  25. </body>
  26. </html>';
  27.  
  28. $url = "http://d...content-available-to-author-only...s.ws/teste2.html?6";
  29. //$html = file_get_contents($url);
  30.  
  31. $getTextoList = '|<div class="listdoTexto">[\w\W]*<\/ul>|';
  32. preg_match_all($getTextoList, $html, $GetTexto);
  33.  
  34. $GetTexto = implode(",", $GetTexto[0]);
  35. $GetTexto = substr($GetTexto, 0, strpos($GetTexto, "</ul>")); //
  36. $GetTexto = strip_tags($GetTexto);
  37. $GetTexto = preg_replace("/\s{2,}|\n/", ",,", trim($GetTexto));
  38. $GetTexto = str_replace(",,", ", ", $GetTexto);
  39.  
  40. echo $GetTexto;
Success #stdin #stdout 0.01s 23660KB
stdin
Standard input is empty
stdout
texto1 qualquer, texto2, texto3, texto4