curl-and-php
Help for login whith Https
Date: Sun, 31 Aug 2008 16:11:38 -0300
Hello!
My code is:
<?
$id = "xxxxxx";
$password = "xxxxxx";
$cookie_file_path = "cookiejar.txt";
$loginURL = "https://pagseguro.uol.com.br/Default.aspx";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1 (ax)";
$POSTFIELDS = 'Email='.$id.'&txtSenha='.$password.'&btnLogin=Entrar';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$loginURL);
curl_setopt($ch, curlOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, curlOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, curlOPT_SSL_VERIFYPEER, FALSE); // this line makes it work
under https
$result=curl_exec($ch);
$temparr = explode("id=\"__VIEWSTATE\" value=\"",$result);
$__VIEWSTATE = explode("\" />",$temparr[1]);
$temparr2 = explode("id=\"__EVENTVALIDATION\" value=\"",$result);
$__EVENTVALIDATION = explode("\" />",$temparr2[1]);
$POSTFIELDS =
'Lili1_OffsetY=0&Lili1_OffsetX=0&ckbSalvarEmail=on&Email='.$id.'&txtSenha='.$password.'&btnLogin=Entrar&__VIEWSTATE='.$__VIEWSTATE[0].'&__EVENTVALIDATION='.$__EVENTVALIDATION[0];
curl_setopt($ch, CURLOPT_URL,$loginURL);
curl_setopt ($ch, CURLOPT_POST, TRUE );
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
$result=curl_exec($ch);
curl_close ($ch);
echo($result);
die();
?>
See result on http://www.agentesite.com.br/curl/curl_pagseguro.php ; Server
Error in '/' Application.
I need login in https://pagseguro.uol.com.br/Login.aspx , for test login use
login = noisae_at_hotmail.com and pass = test123
Please i need help !! ...
Thank's!!!!!
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-08-31