Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Pobranie linków situ z google
shtoc
post
Post #1





Grupa: Zarejestrowani
Postów: 128
Pomógł: 0
Dołączył: 18.11.2008
Skąd: Polska

Ostrzeżenie: (10%)
X----


jak w temacie (IMG:http://forum.php.pl/style_emoticons/default/exclamation.gif) napisałem skrypt którym chciałbym pobrać linki z google z zapytania site:domena.pl

  1. <?php
  2. $adres=&#092;"http://www.google.pl/search?hl=pl&lr=&q=site:domena.pl&start=0&sa=N\";
  3.  
  4. $url = curl_init($adres);
  5. curl_setopt($url, CURLOPT_USERAGENT, 'holmes/3.10.1 (OnetSzukaj/5.0; +http://szukaj.onet.pl)');
  6. curl_setopt($url, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($url, CURLOPT_CONNECTTIMEOUT, 5);
  8. curl_setopt($url, CURLOPT_HEADER, 0);
  9. $strona=curl_exec($url);
  10.  
  11.  
  12.  
  13. $DOM = new DOMDocument();
  14. @$DOM->LoadHTML(iconv(&#092;"UTF-8\",\"UTF-8\",$strona));
  15.  
  16.  
  17.            foreach($DOM->getElementsByTagName('div') as $div)
  18.            {
  19.                $class = $div ->getAttribute('class');
  20.              
  21.                if($class == 's')
  22.                {
  23.                   $link = $div->nodeValue;
  24.                  # $link = $div->getAttribute('cite');
  25.                  # $link = $div->getElementsByTagName('cite');
  26.                }
  27.              
  28.            }    
  29.          
  30. echo 'linki'.$link;
  31.  
  32. ?>



Próbowałem pobrać linki na te 3 sposoby ale żaden nie daje rezultatu
możne ktoś widzi błąd ?

Ten post edytował shtoc 3.03.2009, 16:32:51
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.12.2025 - 13:41