Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> 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
mat-bi
post
Post #2





Grupa: Zarejestrowani
Postów: 690
Pomógł: 92
Dołączył: 6.02.2011

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


curl_setopt, opcja CURLOPT_PROXY ( czy jakoś tak, nie chce mi się do manuala zaglądać (IMG:style_emoticons/default/wink.gif) )
Go to the top of the page
+Quote Post
ciniutek
post
Post #3





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
mat-bi
post
Post #4





Grupa: Zarejestrowani
Postów: 690
Pomógł: 92
Dołączył: 6.02.2011

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


A gdzie ty wywołujesz tą funkcję?
Go to the top of the page
+Quote Post
ciniutek
post
Post #5





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

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


tzn ? (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
mat-bi
post
Post #6





Grupa: Zarejestrowani
Postów: 690
Pomógł: 92
Dołączył: 6.02.2011

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


wywołujesz tą funkcję, jak każdą inną, przejrzyj, naucz się i będzie ok
Go to the top of the page
+Quote Post

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: 21.09.2025 - 04:50