dakata__92
Super Moderator
Това е текста на съобщението:
Защо се получава?Received HTTP code 302 from proxy after CONNECT
PHP:
class CurlResponse
{
private $array = array(
"useragent" => "Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16",
"referer" => "https://www.google.bg/?gws_rd=ssl",
"proxy" => "",
"proxyport" => "",
"postfields" => ""
);
public function __construct()
{
}
public function setResponseOption(Array $array)
{
$this->array = array_merge($this->array,$array);
}
public function getResponse($url){
$ch = curl_init($url);
$options = array(
CURLOPT_CONNECTTIMEOUT => null,
CURLOPT_USERAGENT => $this->array["useragent"],
CURLOPT_REFERER => $this->array["referer"],
CURLOPT_PROXY => $this->array["proxy"],
CURLOPT_PROXYPORT => $this->array["proxyport"],
CURLOPT_HTTPPROXYTUNNEL => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
);
if ($this->array["postfields"]) {
array_push(
$options,
array(
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $this->array["postfields"]
)
);
}
curl_setopt_array($ch, $options);
if (!$html = curl_exec($ch)) {
$html = curl_error($ch);
}
curl_close($ch);
return $html;
}
}