Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] preg_match_all .. - problem
b4x
post
Post #1





Grupa: Zarejestrowani
Postów: 658
Pomógł: 95
Dołączył: 20.12.2005
Skąd: N54,35° E18,63° (Gdańsk)

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


Witam oto mam taki problem..
Chcę pobrać treść aukcji z allegro

mam takie coś :

  1. <?php
  2. $url= "http://www.allegro.pl/show_item.php?item=1111111";
  3. preg_match_all('/<fieldset id="(.+?)" style="(.+?)">(.+?)</fieldset>/', $url, $tresc);
  4. print_r($tresc);
  5. ?>



W źródle strony wygląda to tak :

  1. <fieldset id="user_field" style="overflow:auto;position:relative;top:0;border:none;margin:0;padding:0;text-align:left;">
  2. jakiś tam opis...
  3.  
  4. <!-- --><!-- end description (1) " '-->
  5.  


Mógłby ktoś mi wskazać gdzie popełniłem błąd?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
PawelC
post
Post #2





Grupa: Zarejestrowani
Postów: 1 173
Pomógł: 121
Dołączył: 24.09.2007
Skąd: Toruń

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


Ten kod wyświetli Ci całą strone z grafiką etc z allegro (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
  1. <?php
  2. $adres="http://www.allegro.pl/show_item.php?item=1111111";
  3. $ch = curl_init(urldecode($adres));
  4. curl_setopt($ch, CURLOPT_HEADER, 0);
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  6. $pobrane_zrodlo = curl_exec($ch);
  7.  
  8. preg_match_all('/<fieldset id="(.+?)" style="(.+?)">(.+?)</fieldset>/', $pobrane_zrodlo, $tresc);
  9. print $pobrane_zrodlo;
  10. curl_close($ch);
  11. ?>

zmodyfikuj go sobie aby Ci tylko tekst wyświetlił (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 11.10.2025 - 23:55