Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]curl i proxy, jw
miras
post 24.04.2017, 22:23:10
Post #1





Grupa: Zarejestrowani
Postów: 1 004
Pomógł: 9
Dołączył: 18.01.2011
Skąd: Siedlce

Ostrzeżenie: (30%)
XX---


Witam, podpowie mi ktoś dlaczego po wykonaniu tego kodu dostaję IP mojego vps'a a nie zmienione?

  1. $curl=curl_init("http://dynupdate.no-ip.com/ip.php");
  2. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  3. curl_setopt($curl, CURLOPT_TIMEOUT, 10);
  4. curl_setopt($curl, CURLPROXY_HTTP, "http://83.31.180.143:8080");
  5. $wynik=curl_exec($curl);
  6. echo $wynik;


--------------------
Go to the top of the page
+Quote Post
markuz
post 24.04.2017, 22:46:03
Post #2





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

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


Dodaj opcję CURLOPT_VERBOSE na true i pokaż wynik


--------------------
Go to the top of the page
+Quote Post
miras
post 24.04.2017, 22:48:24
Post #3





Grupa: Zarejestrowani
Postów: 1 004
Pomógł: 9
Dołączył: 18.01.2011
Skąd: Siedlce

Ostrzeżenie: (30%)
XX---


bez zmian...

Czy może mieć na to jakiś wpływ konfiguracja vps'a?

Ten post edytował miras 24.04.2017, 22:49:26


--------------------
Go to the top of the page
+Quote Post
markuz
post 24.04.2017, 23:27:20
Post #4





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

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


Ale co bez zmian? Wynik VERBOSE poproszę smile.gif Odpal ten skrypt z poziomu CLI i wklej wynik polecenia tutaj.


--------------------
Go to the top of the page
+Quote Post
miras
post 25.04.2017, 11:16:35
Post #5





Grupa: Zarejestrowani
Postów: 1 004
Pomógł: 9
Dołączył: 18.01.2011
Skąd: Siedlce

Ostrzeżenie: (30%)
XX---


Ok, ten kod jest ok (prawdopodobnie zle proxy mialem).

  1. <?php
  2. $proxy_ip = '109.196.127.35'; //proxy IP here
  3. $proxy_port = 8888; //proxy port from your proxy list
  4. $url = 'http://dynupdate.no-ip.com/ip.php'; //URL to get
  5.  
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_HEADER, 0); // no headers in the output
  8. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable
  9. curl_setopt($ch, CURLOPT_PROXYPORT, $proxy_port);
  10. curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
  11. curl_setopt($ch, CURLOPT_PROXY, $proxy_ip);
  12. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  13. curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
  14. curl_setopt($ch, CURLOPT_URL, $url);
  15. $data = curl_exec($ch);
  16. curl_close($ch);
  17.  
  18. var_dump($data);
  19.  
  20. ?>
  21.  
  22.  


natomiast pojawia się teraz taki problem, że jeżeli strona ma ssl to zwraca false, jakis pomysl?

Nikt nie ma pomysłu dlaczego tak sie dzieje? Dla ssl'a musi byc jakies inne proxy?

Ten post edytował miras 25.04.2017, 00:17:42


--------------------
Go to the top of the page
+Quote Post
markuz
post 25.04.2017, 16:49:58
Post #6





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

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


Tak, do obsługi SSL musi być specjalne proxy które obsłuży HTTPS

Ten post edytował markuz 25.04.2017, 19:48:06


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.06.2025 - 07:56