Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Powtarzanie się elementów i ich pobranie
RazoR2011
post
Post #1





Grupa: Zarejestrowani
Postów: 38
Pomógł: 1
Dołączył: 20.04.2011

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


Cześć!

Mam zapisaną stronę internetową w stylu
  1. <a title="link 1" href="link" class="klasa"> </a>
  2. <a title="link 2" href="link" class="klasa"> </a>
  3. <a title="link 3" href="link" class="klasa"> </a>
  4. <a title="link 4" href="link" class="klasa"> </a>


Chciałbym teraz pobrać wszystkie informacje o linku czyli tytuł, href i klasę. Mam funkcję znajdującą tekst pomiędzy konkretnymi znakami. Niestety ale nie wiem w jaki sposób mam przechodzić do kolejnych wierszy w źródle strony - skrypt zawsze wyświetla ten pierwszy (IMG:style_emoticons/default/smile.gif) Ktoś pomoże?


Funkcja:
  1. function get_string_between($string, $start, $end){
  2. $string = ' ' . $string;
  3. $ini = strpos($string, $start);
  4. if ($ini == 0) return '';
  5. $ini += strlen($start);
  6. $len = strpos($string, $end, $ini) - $ini;
  7. return substr($string, $ini, $len);
  8. }


Ten post edytował RazoR2011 24.11.2017, 12:07:09
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
viking
post
Post #2





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

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


http://php.net/manual/en/book.simplexml.php
https://prophp.pl/article/9/phpquery_-_szyb...bienstwo_jquery
http://php.net/manual/en/class.domdocument.php
http://simplehtmldom.sourceforge.net/manual.htm
Go to the top of the page
+Quote Post

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: 22.08.2025 - 15:53