Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Xpath błąd pobierania strony
omi
post
Post #1





Grupa: Zarejestrowani
Postów: 60
Pomógł: 0
Dołączył: 6.11.2017

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


Witam! Chciałem pobrać zawartość tej strony https://www.tibia.com/community/?subtopic=k...amp;world=Dibra mam taki kod:

  1.  
  2.  
  3. $db = mysqli_connect($serwer, $uzytkownik, $haslo, $nazwa_bazy);
  4. ini_set('MAX_EXECUTION_TIME', 5600);
  5. if (mysqli_connect_errno())
  6. {
  7. echo 'Blad';
  8. exit;
  9. }
  10. else {
  11. }
  12.  
  13.  
  14.  
  15.  
  16. $html = file_get_contents('https://www.tibia.com/community/?subtopic=killstatistics&world=Dibra');
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. $dom = new DOMDocument;
  24. libxml_use_internal_errors(true);
  25. $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
  26. libxml_clear_errors();
  27. $dom->encoding = 'UTF-8';
  28.  
  29. $xpath = new DOMXPath($dom);
  30.  
  31.  
  32.  
  33.  
  34. $dibraxyztds1 = $xpath->query('//table//td[text()="Sir Valorcrest "]/ancestor::tr/td[3]');
  35. $dibraxyztds21 = $xpath->query('//table//td[text()="Sir Valorcrest "]/ancestor::tr/td[2]');
  36.  
  37. foreach($dibraxyztds1 as $dibraxyztd1)
  38. foreach($dibraxyztds21 as $dibraxyztd21)
  39.  
  40.  
  41. echo $dibraxyztd1->nodeValue;
  42. echo $dibraxyztd21->nodeValue;
  43. {
  44.  


Wczoraj wszystko działało a dzisiaj nie działa. Gdzie może być błąd ?
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 24.08.2025 - 16:21