Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [preg_match] "Ściąganie" linków ze strony
Kenobi
post 15.11.2010, 19:09:02
Post #1





Grupa: Zarejestrowani
Postów: 27
Pomógł: 0
Dołączył: 2.07.2010

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


Witam.
Mam taką np. stronę : http://www.youtube.com/user/USER?feature=mhum#p/u i chcę pobrać wszystkie linki do jego filmików za pomocą curla oraz preg_match.
Mam taki kod :
  1. <?php
  2. $user = $_POST['user'];
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_URL, "http://www.youtube.com/user/$user?feature=mhum#p/u");
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  6. $html = curl_exec($ch);
  7. curl_close($ch);
  8.  
  9. //preg_match("/\<div.id=\"(.*?)\"\>(.*?)\<\/div\>/si", $html, $match);
  10. preg_match("/\<div class=\"encryptedVideoId\" style=\"display: none;\"\>(.*?)\<\/div\>/si", $html, $match);
  11.  
  12. print_r($match);
  13. print_r($match[0]);
  14. print_r($match[1]);
  15. ?>


Lecz on nie działa.
Proszę o pomoc.
Go to the top of the page
+Quote Post
Mephistofeles
post 15.11.2010, 19:20:21
Post #2





Grupa: Zarejestrowani
Postów: 1 182
Pomógł: 115
Dołączył: 4.03.2009
Skąd: Myszków

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


Nie można do tego wykorzystać Youtube API?
Go to the top of the page
+Quote Post
Kenobi
post 15.11.2010, 20:03:59
Post #3





Grupa: Zarejestrowani
Postów: 27
Pomógł: 0
Dołączył: 2.07.2010

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


Hmm..ale jak ? ;s
Go to the top of the page
+Quote Post

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 - 05:37