<?php
$url = 'https://www.site.com';
$user_agent = "Mozilla/4.0 (compatible; MSIE 6.01; Windows NT 5.0)";
$proxy='127.0.0.1:1080';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_AUTOREFERER,TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR,getcwd().'/cookie.txt');
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
$result=@curl_exec ($ch);
if($result)
{
preg_match("/<form method=\"post\" name=\"login_form\" action=\"(.*)\">/i", $result, $m);
$post_data="login=".urlencode('asas')."&password=".urlencode('qwertyuiop');
$ch2=curl_copy_handle($ch);
curl_close ($ch);
curl_setopt($ch2, CURLOPT_COOKIEFILE,getcwd().'/cookie.txt');
curl_setopt($ch2, CURLOPT_URL,$m[1]);
curl_setopt($ch2, CURLOPT_POST, 1);
curl_setopt($ch2, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION,TRUE);
$res2=curl_exec ($ch2);
} else {
die (curl_error($ch));
}
curl_close ($ch2);
echo("Results: <br>".$res2);
?>