Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Parsowanie danych z innej strony
Wilu88
post 7.11.2015, 22:28:09
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 6
Dołączył: 7.03.2010

Ostrzeżenie: (0%)
-----


Witam stoje przed zadaniem wyciagniecia danych z takiej oto struktury na stronie www z wynikami zawodów:

  1. <table class="xtable small" cellspacing="0" style="width: 100%; "><thead><tr>
  2. <th style="width: 12%; ">Date</th>
  3. <th style="width: 7%; ">Result</th>
  4. <th style="width: 2%; ">&nbsp;</th>
  5. <th style="width: 55%; ">Race</th>
  6. <th style="width: 6%; ">Class</th>
  7. <th style="width: 7%; ">Distance</th>
  8. <th style="width: 5%; ">Points PCS</th>
  9. <th style="width: 5%; ">Points UCI</th>
  10. </tr></thead><tbody> <tr>
  11. <td>21.06.2015</td>
  12. <td>71</td>
  13. <td><img src="site-icons/classification-general.png" style="height: 12px; margin-bottom: -2px; " /></td>
  14. <td><span class="flags_ch"></span> <a class="BlackToRed" href="race/Tour_de_Suisse_2015">Tour de Suisse<span class="blue" style="font-size: 11px; "> - General Classification</span></a></td>
  15. <td><span style="font-size: 11px; ">2.UWT</span></td>
  16. <td><span style="font-size: 11px; "></span></td>
  17. <td><span style="font-size: 11px; ">5</span></td>
  18. <td><span style="font-size: 11px; "></span></td>
  19. </tr> <tr>
  20. <td>11.04.2015</td>
  21. <td>8</td>
  22. <td><img src="site-icons/classification-general.png" style="height: 12px; margin-bottom: -2px; " /></td>
  23. <td><span class="flags_es"></span> <a class="BlackToRed" href="race/Vuelta_Ciclista_al_Pais_Vasco_2015">Vuelta Ciclista al Pais Vasco<span class="blue" style="font-size: 11px; "> - General Classification</span></a></td>
  24. <td><span style="font-size: 11px; ">2.UWT</span></td>
  25. <td><span style="font-size: 11px; "></span></td>
  26. <td><span style="font-size: 11px; ">90</span></td>
  27. <td><span style="font-size: 11px; ">20</span></td>
  28. </tr> <tr>
  29. <td>15.03.2015</td>
  30. <td>2</td>
  31. <td><img src="site-icons/classification-general.png" style="height: 12px; margin-bottom: -2px; " /></td>
  32. <td><span class="flags_fr"></span> <a class="BlackToRed" href="race/Paris_nice_2015">Paris - Nice<span class="blue" style="font-size: 11px; "> - General Classification</span></a></td>
  33. <td><span style="font-size: 11px; ">2.UWT</span></td>
  34. <td><span style="font-size: 11px; "></span></td>
  35. <td><span style="font-size: 11px; ">190</span></td>
  36. <td><span style="font-size: 11px; ">80</span></td>
  37. </tr>
  38.  
  39. </tbody></table>


Z tej tabeli potrzebuje wyłuskać tak naprawde tylko pierwsze dwa <td> w każdym z <tr> oraz 4 <td>. problem w tym że te poszczególne komórki nei mają żadnych klas aby łatwo można było to ogarnąć za pomocą preg_match_all i stąd moja prośba czy ktoś ma jakis pomysł jak to ogarnąć?
Go to the top of the page
+Quote Post
viking
post 7.11.2015, 22:32:29
Post #2





Grupa: Zarejestrowani
Postów: 6 376
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Jakikolwiek parser dom np phpquery i nth child. Bo niby dlaczego strukturę dom miałbyś wyluskac regexpem?


--------------------
Go to the top of the page
+Quote Post
Wilu88
post 9.11.2015, 18:35:30
Post #3





Grupa: Zarejestrowani
Postów: 158
Pomógł: 6
Dołączył: 7.03.2010

Ostrzeżenie: (0%)
-----


Cytat(viking @ 7.11.2015, 22:32:29 ) *
Jakikolwiek parser dom np phpquery i nth child. Bo niby dlaczego strukturę dom miałbyś wyluskac regexpem?


Dzięki za pomoc właśnie o to mi chodziło smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 2.05.2025 - 06:17