Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> preg_match i wydobycie tabeli z kodu html
Grzesiek23
post
Post #1





Grupa: Zarejestrowani
Postów: 47
Pomógł: 0
Dołączył: 25.12.2009

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


Pobieram kod html pewnej strony i chciałbym do zmiennej wrzucić jedynie tabelę, która wygląda mniej więcej tak:

...
<table class="messages largepadded">
<trd><td>...</td></tr>
....
</table>
...


Napisałem taką funkcję:

  1. function gettable($page)
  2. {
  3. preg_match("@<table class=\"messages largepadded\">(.*?)<\/table>@i", $page, $w);
  4. return $w[0];
  5. }



Ale przy wywołaniu tej funkcji:

  1. echo(gettable($s));


Otrzymuję błąd:
PHP Notice: Undefined offset: 0 in C:\inetpub\wwwroot\test.php on line 13


Pomoże ktoś?
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 22.08.2025 - 05:25