<?php
foreach(file('proxy.txt') as $line) {
$isMatched = preg_match('/(.+):(.+):(.+):(.+)/', $line, $matches);
$url = 'https://www.youtube.com/';
$proxy = $matches[1].':'.$matches[2]; // ip:port
$proxyauth = $matches[3].':'.$matches[4]; // name:pass
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET');
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
}
?>
имею такой код, и такую ошибку:
HTTP/1.0 407 Proxy Authentication Required Proxy-Authenticate: Basic realm="proxy" Connection: close Content-type: text/html; charset=utf-8
как исправить?