Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Wyciągnięcie "diva" z strony zew.
simivar
post 26.04.2012, 18:12:37
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 16.05.2009

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


Mam taki skrypt:
  1. function curl_file_get_contents($URL)
  2. {
  3. $c = curl_init();
  4. curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt($c, CURLOPT_URL, $URL);
  6. $contents = curl_exec($c);
  7. curl_close($c);
  8.  
  9. if ($contents) return $contents;
  10. else return FALSE;
  11. }
  12.  
  13. if(!($zmienna = curl_file_get_contents('http://www.lolking.net/summoner/eune/28222962#profile')))
  14. echo 'Connection fail';
  15.  
  16. preg_match_all('@<div[^>]+id="tab-profile">(.*)<\/div>@', $zmienna, $matches);
  17.  
  18. print_r($matches);


Zmienna $zmienna jest pobierana, jednak preg_match_all() nie wiem czemu nie znajduje mi diva, którego chce znaleźć.

Zwraca mi:
  1. Array ( [0] => Array ( ) [1] => Array ( ) )


Chcę pobrać to:
http://wklej.to/WxkjW
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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 03:25