Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie danych z wykorzystaniem proxy .
ciniutek
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 29.05.2011

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


Witam . mam problem . Jak zrobić , żeby mój skrypt pobierał dane z innej strony za pośrednictwem proxy ? (IMG:style_emoticons/default/smile.gif) siedzę i się głowie i nie działa nic (IMG:style_emoticons/default/sad.gif) proszę o jakąś wskazówkę . Oto kawałek kodu ze skryptu
  1. $url = 'http://link do strony .pl'';
  2. $nowe = stripslashes(file_get_contents($url));


Z góry dziękuje za pomoc .
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
ciniutek
post
Post #2





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 29.05.2011

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


Znalazłem i przerobiłem takie coś i nie działa .. Sprawdzałem na paru proxach i nic ..

  1.  
  2. function cUrl($adres, $url)
  3. {
  4.  
  5. $curl = curl_init();
  6. curl_setopt($curl, CURLOPT_URL, $adres);
  7. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, FALSE);
  9. curl_setopt($curl, CURLOPT_PROXY, '200.196.234.26:8080');
  10. curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12');
  11. curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__)."/cookies.txt");
  12. curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__)."/cookies.txt");
  13. $str = curl_exec($curl);
  14. curl_close($curl);
  15. return $str;
  16. }
  17.  
  18. $url = 'link'';
  19. $nowe = stripslashes(file_get_contents($url));
  20.  


Ten post edytował ciniutek 14.06.2011, 19:41:52
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: 16.10.2025 - 20:46