Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] curl - pobieranie konkretnego diva, [PHP] curl - pobieranie konkretnego diva strony.
morswin98
post 15.05.2012, 21:04:25
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 8.05.2012

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


  1. <?php
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL,( "strona...");
  4. curl_exec($ch);
  5. curl_close($ch);
  6. ?>


Witam. Ten oto kod pobiera mi cała stronę ze wszystkimi grafikami co zrobić aby był pobrany konkretny tekst lub div.
Z góry dziękuje za pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
Tajgeer
post 15.05.2012, 21:05:55
Post #2





Grupa: Zarejestrowani
Postów: 290
Pomógł: 48
Dołączył: 11.05.2008
Skąd: Kielce

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


Pobierz całą stronę, a następnie używasz np. funkcji preg_match aby wyciągnąc interesujący Cię tekst.

Jeśli nie czujesz się zbyt pewnie w wyrażeniach regularnych, skorzystaj z PHP Simple HTML DOM Parser.

Ten post edytował Tajgeer 15.05.2012, 21:13:29
Go to the top of the page
+Quote Post
morswin98
post 16.05.2012, 15:31:34
Post #3





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 8.05.2012

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


Próbuje skorzystać z tego drugiego linku ale
  1. $html = file_get_html('http://www.google.com/');
w tej linijce wywala mi błąd.
Potrzebuje obsługi jquery?

Ten post edytował morswin98 16.05.2012, 15:34:28
Go to the top of the page
+Quote Post
markonix
post 16.05.2012, 15:35:53
Post #4





Grupa: Zarejestrowani
Postów: 2 707
Pomógł: 290
Dołączył: 16.12.2008
Skąd: Śląsk

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


Podaj ten błąd....

Co ma jQuery wspólnego z bibliotekami PHP?


--------------------
Go to the top of the page
+Quote Post
morswin98
post 16.05.2012, 15:54:54
Post #5





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 8.05.2012

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


Moja wersja PHP to 5.2.6.
Dajmy taki kod np
  1. <?php
  2. echo file_get_html('http://www.google.com/')->plaintext;
  3. ?>

Błąd:
Fatal error: Call to undefined function file_get_html() in************curl2.php on line 2
*wykasowane przeze minie

Ten post edytował morswin98 16.05.2012, 15:55:13
Go to the top of the page
+Quote Post
strike
post 16.05.2012, 15:59:35
Post #6





Grupa: Zarejestrowani
Postów: 36
Pomógł: 1
Dołączył: 6.05.2012

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


obiekt najpierw trzeba utworzyć

Ten post edytował strike 16.05.2012, 16:01:09


--------------------
Pomogłem? Kliknij w podzięce "Pomógł" :)
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 - 09:57