1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
$url = "http://www.mypage/blabla.aspx";
$postfields0 = array();
$postfields0["action"] = "submit";
$postfields0['__EVENT'] = '';
$postfields0['__EVENTENT'] = '';
$postfields0['__VIEWSTATE'] = '/wg8PFgIeB1Zpc2libGVnZGRk';
$postfields0['__EVENTVALIDATION'] = '/wEWBAK00It1Atze5w0=';
$postfields0['ctl00_ContentPlaceHolder1_TextBox1'] = 'mypass';
$postfields0['ctl00$ContentPlaceHolder1$Button1'] = 'Button';
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8";
$referer = $url;
//Initialize a new CURL session
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_MAXREDIRS,1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
//we send a referrer
curl_setopt($ch, CURLOPT_REFERER, $referer);
//we get back the result in a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($cr, CURLOPT_COOKIEJAR, '/Log/cookie.txt');
echo '<br>follow location:';
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
echo '<br>proxy:';
//proxy
curl_setopt($ch, CURLOPT_PROXY, '208.xx.xxx.xx');
curl_setopt($ch, CURLOPT_PROXYPORT, '3128');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "xxx:xxx");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields0);
echo '<br> exec:';
$result = curl_exec($ch);
curl_close($ch);
//echo the result
echo '<br>0result:',$result; |
Partager