2012-11-24 3 views
1

내가 가진 작업 사용자 정의 PHP는 프록시 클래스 => 내가 너무 =>PHP 프록시 더 이상

$proxy = new Proxy("PROXY_IP:PROXY_PORT"); 
    $content = $proxy->get_page($url); 

같은 init을 그리고 모든 며칠 전까지 벌금 일하는

class Proxy 
{ 
    private $proxy, 
      $header, 
      $timeout, 
      $agent; 

    public function __construct($proxy, $header = null, $timeout = null, $agent = null) { 
     $this->proxy = $proxy; 
     $this->header = empty($header) ? 1 : $header; 
     $this->timeout = empty($timeout) ? 5 : $timeout; 
     $this->agent = empty($agent) ? "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8" : $agent; 
    } 

    public function set_proxy($proxy) { 
     $this->proxy = $proxy; 
    } 

    public function get_page($url, $referer = "http://www.google.com/") { 
     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_HEADER, $this->header); 

     curl_setopt($ch, CURLOPT_PROXY, $this->proxy); 
     curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true); 
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout); 
     curl_setopt($ch, CURLOPT_REFERER, $referer); 
     curl_setopt($ch, CURLOPT_USERAGENT, $this->agent); 
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

     $result = array(); 
     $result['exe'] = curl_exec($ch); 
     $result['inf'] = curl_getinfo($ch); 
     $result['err'] = curl_error($ch); 

     curl_close($ch); 

     return $result; 
    } 
} 

. 이제 대부분 Received HTTP code 403 from proxy after CONNECT과 관련된 오류 메시지가 계속 나타납니다. 수정되지 않은 코드가 어떻게 작동을 멈출 수 있는지 전혀 알지 못하기 때문에이 문제를 디버깅하는 방법을 모릅니다.

도움을 주시면 감사하겠습니다. 감사합니다.

EDIT : 403 상태 코드가 무엇을 의미하는지 알고 있습니다. 어떤 프록시를 사용하든 관계없이 403을 사용한다는 의미입니다. 어떤 페이지를 사용해도 문제가 발생하지 않습니다.

답변

0

은 상태 코드를 알고 : http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

403는 "금지"를 의미한다. 나는 당신이 자신의 서비스를 사용하기에 충분히 신뢰할 수 없다는 것을 당신이 결정한, 또는 결정한 것 같아요. 또는 액세스하는 실제 프록시에 암호가 있습니다.

관련 문제