Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie danych ze strony, Help
marcinvx
post
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


  1. <table cellpadding="0" cellspacing="0" align="center" rules="all">
  2. <tr>
  3. <td width="320"><b>Prezenter:</b> <span class="stream_genre"></span></td>
  4.  
  5. <td rowspan="2" width="80" height="36" align="center"><b>Słuchaczy:<br /><font size="3"><span class="stream_slucha"></span></font></b></td>
  6. </tr>
  7. <tr>
  8. <td><b>Audycja:</b> <span class="stream_title">B-Day ^^</span></td>
  9. </tr>
  10. </table>

Pobieranie danych pomiędzy <td><b>Audycja:</b> <span class="stream_title"> a </span></td> Czyli chciałbym aby na stronie wyświetlało się B-Day Party ^^
Jak zrobić ?
Ja nic nie mogę znaleźć. ;/
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
Gribo
post
Post #2





Grupa: Zarejestrowani
Postów: 237
Pomógł: 17
Dołączył: 1.11.2007
Skąd: Zielona Góra

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


możesz to zrobić na kilka sposobów:
-wyrażenie regularne
-xpath
-jeśli nie umiesz obydwu rozwiązań możesz zainteresować się biblioteką "PHP Simple HTML DOM"
Go to the top of the page
+Quote Post
jaslanin
post
Post #3





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


  1. <pre>
  2. <?
  3.  
  4. $html = '
  5. <table cellpadding="0" cellspacing="0" align="center" rules="all">
  6. <tr>
  7. <td width="320"><b>Prezenter:</b> <span class="stream_genre"></span></td>
  8.  
  9. <td rowspan="2" width="80" height="36" align="center"><b>Słuchaczy:<br /><font size="3"><span class="stream_slucha"></span></font></b></td>
  10. </tr>
  11. <tr>
  12. <td><b>Audycja:</b> <span class="stream_title">B-Day ^^</span></td>
  13. </tr>
  14. </table>
  15. ';
  16.  
  17. preg_match_all("#Audycja.*stream_title.*>(.+)<#isU", $html, $matchesarray);
  18.  
  19. print_r($matchesarray);
  20.  
  21. ?>
  22. </pre>
Go to the top of the page
+Quote Post
marcinvx
post
Post #4





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


To nie bedzie działać bo nie ma jak. ;/


  1. <table cellpadding="0" cellspacing="0" align="center" rules="all">
  2. <tr>
  3. <td width="320"><b>Prezenter:</b> <span class="stream_genre"></span></td>
  4. <td rowspan="2" width="80" height="36" align="center"><b>Słuchaczy:<br /><font size="3"><span class="stream_slucha"></span></font></b></td>
  5. </tr>
  6. <tr>
  7. <td><b>Audycja:</b> <span class="stream_title">B-Day ^^</span></td>
  8. </tr>
  9. </table>

To jest tylko fragment kodu ze strony:
  1. http://eradia.pl/script/player.php?id=13506&cmd=home

i chcę na swojej stronie wyświetlać dane o tym co teraz leci za piosenka w tym radiu.
Go to the top of the page
+Quote Post
jaslanin
post
Post #5





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


działa.

  1. <pre>
  2. <?
  3.  
  4. preg_match_all("#Audycja.*stream_title.*>(.+)<#isU", file_get_contents("http://eradia.net/script/player.php?id=13506&cmd=home"), $matchesarray);
  5.  
  6. print_r($matchesarray);
  7.  
  8. ?>
  9. </pre>


Ten post edytował jaslanin 2.04.2011, 18:09:15
Go to the top of the page
+Quote Post
marcinvx
post
Post #6





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 11.02.2011

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


  1. (
  2. [0] => Array
  3. (
  4. [0] => Audycja: DanceMusicParty.<
  5. )
  6.  
  7. [1] => Array
  8. (
  9. [0] => DanceMusicParty.
  10. )
  11.  
  12. )


(IMG:style_emoticons/default/questionmark.gif) I Co dalej ? Jak zrobić zeby wyświetlało tylko "DanceMusicParty." (IMG:style_emoticons/default/questionmark.gif)
Co to narazie wyszlo mozesz zobaczyc:
  1. http://gold-racing.pl/radio.php
Go to the top of the page
+Quote Post
jaslanin
post
Post #7





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


Musisz wykazać trochę inicjatywy i sam to zrobić, tu masz trochę kursów jak się operuje na tablicy:

http://www.google.pl/search?hl=pl&biw=...mp;aql=&oq=
http://www.google.pl/search?hl=pl&biw=...mp;aql=&oq=
http://www.google.pl/search?hl=pl&biw=...mp;aql=&oq=
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: 5.10.2025 - 20:41