Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]wyrazenia regularne, Jak wyciac dany kod z innej strony www
webspy
post
Post #1





Grupa: Zarejestrowani
Postów: 186
Pomógł: 9
Dołączył: 3.03.2008

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


Witam, czytałem trochę o wyciąganiu danych ze strony, udało mi się wyciągnąć kod źródłowy z danej strony ale nie mogę sobie poradzić z wyrażeniami regularnymi (IMG:style_emoticons/default/sad.gif) jestem początkującym jeśli chodzi o php. Podany kod znalazłem właśnie na tej stronie.

  1. <?
  2. $curl = curl_init();
  3. curl_setopt($curl, CURLOPT_URL, 'http://adres strony');
  4. curl_setopt($curl, CURLOPT_REFERER, "http://www.google.pl/");
  5. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  6. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)');
  8. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  9. curl_setopt($curl, CURLOPT_HEADER, 0);
  10. $strona = curl_exec($curl);
  11. curl_close($curl);
  12.  
  13.  
  14. preg_match_all('wyrazenie regularne', $strona, $baza);
  15.  
  16. echo $baza[1][0];
  17. ?>
  18.  


Chciałbym z ze strony wyciągnąć dane które wyglądają nastepująco:

  1. <tr class="rowEven clickable">
  2. <td class="cellPhoto">
  3. <img src="http://photos02.allegroimg.pl/photos/64x48...74/52/868745275" width="64" height="48" alt="AGREGAT PRĄDOTWÓRCZY 3 KW 2800W!! FV SKLEP" title="AGREGAT PRĄDOTWÓRCZY 3 KW 2800W!! FV SKLEP"/>
  4. </a>
  5. </td>
  6. <td class="cellName">
  7. class="alleLink">
  8. <span>AGREGAT PRĄDOTWÓRCZY 3 KW 2800W!! FV SKLEP</span></a>
  9. </td>
  10. <td class="cellPrice"><img src="http://static.allegrostatic.pl/site_images...buy_now_ico.gif" alt="" title="" class="tomiddle" /> 899,00 zł</td>
  11. <td class="cellTrans">929,00 zł</td>
  12. <td class="cellOffer">-</td>
  13. <td class="cellTime">7 dni</td>
  14. </tr>
  15.  


Z góry dziękuję za pomoc.
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: 23.08.2025 - 23:59