Hello to all! Why doesn't it connect? Without a proxy works. And with a proxy blank screen. Where is the mistake? The curl modules are installed.

<?php //error_reporting(E_ALL); if( $ch = curl_init ()) { curl_setopt ($ch, CURLOPT_URL, 'http://www.ya.ru'); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_PROXY, "79.136.243.142:3128"); curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt ($ch, CURLOPT_FAILONERROR, true); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec($ch); //print curl_errno ($ch); //print $result; echo $result; curl_close ($ch); } ?> 
  • 79.136.243.142 12 1212 cheto painfully familiar port, try to put CURLPROXY_HTTP instead of CURLPROXY_SOCKS5 - Alex Kapustin
  • Issues 7. Should the proxy address and port be set in the browser? And so I tried everything, there is nothing. Proxy with login by the way. - marioxxx
  • one
    And then the browser? If you still need to install with login: CURLOPT_PROXYAUTH - Alex Kapustin
  • Through http the proxy works. And through socks5 no. How so? PHP 5.3.3 version. - marioxxx


1 answer 1

Most likely due to the fact that the proxy server does not socks5.
Try to put CURLPROXY_HTTP instead of CURLPROXY_SOCKS5 , if it CURLPROXY_SOCKS5 , then it is.

  • Okay, look for a socks5 proxy. How to cache a page? We are before the variable stored the page. - marioxxx