Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML] jak wstawić fragment strony?
komanch
post
Post #1





Grupa: Zarejestrowani
Postów: 24
Pomógł: 0
Dołączył: 17.08.2006

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


Chce na moją stronę wstawić fragment innej strony, ale tylko fragment, w moim przypadku chcę samą tabelę ze strony z zewnątrz.
Użyłem:
Kod
<iframe name="demo" src="http://hockey.powerplaymanager.com/pl/liga.html?data=a-ow-iv-28" width="530" height="300" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"></iframe>

Co moge zrobić żeby wyświetlał mi się tylko taki fragment strony który chcę? czyli np samą tabelę.

Ten post edytował komanch 23.02.2009, 19:45:20
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
zegarek84
post
Post #2





Grupa: Zarejestrowani
Postów: 1 332
Pomógł: 294
Dołączył: 12.10.2008
Skąd: Olkusz

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


  1. <?php
  2. $curl = curl_init();
  3. curl_setopt($curl, CURLOPT_URL, "http://hockey.powerplaymanager.com/pl/liga.html?data=a-ow-iv-28");
  4. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  5. $strona = curl_exec($curl);
  6. $wyr='/<tr class=[^<]+?<td class=[^>]+?>([0-9]+?) </td>[^<]+?<td class='name'><img[^<]+?<a href=[^>]+?>([^<]+?)</a>(?: <img[^<]+?)?</td>[^<]+?<td class=[^>]+?> ([0-9]+?)</td>[^<]+?<td> ([0-9]+?)</td>[^<]+?<td class=[^>]+?> ([0-9]+?)</td>[^<]+?<td> ([0-9]+?)</td>[^<]+?<td class=[^>]+?> ([0-9]+?)</td>[^<]+?<td> ([0-9]+?)</td>[^<]+?<td class=[^>]+?> ([0-9]+?)</td>[^<]+?<td> ([^<]+?)</td>[^<]+?<td class=[^>]+?>([^<]+?)</td>/i';
  7. preg_match_all ($wyr,$strona,$matches);
  8. $ile_dopasowan=count($matches);
  9. $ile_razy=count($matches[1]);
  10. echo '<table style="text-align: right;">';
  11. for($i=0;$i<$ile_razy;++$i){echo '<tr>';
  12. for($j=1;$j<$ile_dopasowan;++$j){echo '<td>'.$matches[$j][$i].'</td>';}
  13. echo '</tr>';}
  14. echo '</table>';
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: 8.10.2025 - 01:40