Can't obtain answer with CURL request via proxy without auth.
$url ="https://www.website.com";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($ch, CURLOPT_PROXY, "Proxy:Port");
curl_setopt($ch, CURLOPT_PROXYUSERPWD,"");//no auth
$response = curl_exec($ch);
echo "cURL time: " . (time() - $loadtime) . "s<br />\";
if ($response === false) {
echo "cURL Error: ", curl_error($ch);
} else {
echo $response;
}
Server answer: cURL time: 1s \ cURL Error: TCP connection reset by peer
checking connection with another way:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, 'proxy:port');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt ($ch, CURLOPT_HEADER, 1);
$data = curl_exec ($ch);
$curl_info = curl_getinfo($ch);
curl_close($ch);
echo '<br />';
print_r($curl_info);
Server's answer:
HTTP/1.1 200 Connection established Array ( [url] => https://www.website.com [content_type] => [http_code] => 0 [header_size] => 39 [request_size] => 99 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.360275 [namelookup_time] => 0.004156 [connect_time] => 0.004514 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [redirect_url] => [primary_ip] => 00000000 [certinfo] => Array ( ) [primary_port] => 8080 [local_ip] => 00000000 [local_port] => 36132 )