Cita:
https://autogestion.personal.com.ar/individuos/
MI USUARIO
area: 351
Mi linea: 3390903
Mi Password: 1002
MI CODIGO
Código PHP:
<?php
/************************************************
* Los valores utilizados en toda la secuencia de comandos
************************************************/
// Urls para llamar - la página de inicio de sesión y la página segura
$urlLogin = "https://sso.personal.com.ar/openam/UI/Login";
$urlSecuredPage = "https://autogestion.personal.com.ar/Individuos/default.aspx";
// Nombres y valores para Iniciar sesión
$nameLine='ctl00$LogueoPropio$TxtLinea'; // the name of the line textbox on the login form
$nameArea='ctl00$LogueoPropio$TxtArea'; // the name of the area textbox on the login form
$namePassword='ctl00$LogueoPropio$TxtPin'; // the name of the pin textbox on the login form
$nameLoginBtn='ctl00$LogueoPropio$BtnAceptarSSO'; // the name of the login button (submit) on the login form
$valLinea ='3390903'; // the value to submit for the username
$valArea ='351'; // the value to submit for the username
$valPassword ='1002'; // the value to submit for the password
$valLoginBtn ='Ingresar'; // the text value of the login button itself
// the path to a file we can read/write; this will
// store cookies we need for accessing secured pages
$cookies = 'cookie.txt';
// regular expressions to parse out the special ASP.NET
// values for __VIEWSTATE and __EVENTVALIDATION
$regexViewstate = '/__VIEWSTATE\" value=/wEPDwULLTIxNDY1NDg1ODQPZBYCZg9kFgICAg9kFgICBQ9kFgQCBw8WAh4FY2xhc3MFB29jdWx0YXIWAmYPZBYCZg9kFgJmDw8WAh4ISW1hZ2VVcmxlFgIfAAUHb2N1bHRhcmQCCQ8PFgIeB1Zpc2libGVoZGRk4fvsOs+uznn9WVTXkbncT90vjQE=';
$regexEventVal = '/__EVENTVALIDATION\" value=/wEWBQKX3YiQBQLax5j4DgK++MCHCgK+nZHxBALWjZjDDa95dvCznHHJeCFwT7fCtKBTr3G7';
/************************************************
* utility function: regexExtract
* use the given regular expression to extract
* a value from the given text; $regs will
* be set to an array of all group values
* (assuming a match) and the nthValue item
* from the array is returned as a string
************************************************/
function regexExtract($text, $regex, $regs, $nthValue)
{
if (preg_match($regex, $text, $regs)) {
$result = $regs[$nthValue];
}
else {
$result = "";
}
return $result;
}
/************************************************
* initialize a curl handle; we'll use this
* handle throughout the script
************************************************/
$ch = curl_init();
/************************************************
* first, issue a GET call to the ASP.NET login
* page. This is necessary to retrieve the
* __VIEWSTATE and __EVENTVALIDATION values
* that the server issues
************************************************/
curl_setopt($ch, CURLOPT_URL, $urlLogin);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$data=curl_exec($ch);
// from the returned html, parse out the __VIEWSTATE and
// __EVENTVALIDATION values
$viewstate = regexExtract($data,$regexViewstate,$regs,1);
$eventval = regexExtract($data, $regexEventVal,$regs,1);
/************************************************
* now issue a second call to the Login page;
* this time, it will be a POST; we'll send back
* as post data the __VIEWSTATE and __EVENTVALIDATION
* values the server previously sent us, as well as the
* username/password. We'll also set up a cookie
* jar to retrieve the authentication cookie that
* the server will generate and send us upon login.
************************************************/
$postData = '__VIEWSTATE='.rawurlencode($viewstate)
.'&__EVENTVALIDATION='.rawurlencode($eventval)
.'&'.$nameArea.'='.$valArea
.'&'.$nameUsername.'='.$valUsername
.'&'.$namePassword.'='.$valPassword
.'&'.$nameLoginBtn.'='.$valLoginBtn
;
curl_setOpt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_URL, $urlLogin);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
$data = curl_exec($ch);
/************************************************
* with the authentication cookie in the jar,
* we'll now issue a GET to the secured page;
* we set curl's COOKIEFILE option to the same
* file we used for the jar before to ensure the
* authentication cookie is sent back to the
* server
************************************************/
curl_setOpt($ch, CURLOPT_POST, FALSE);
curl_setopt($ch, CURLOPT_URL, $urlSecuredPage);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
$data = curl_exec($ch);
// at this point the secured page may be parsed for
// values, or additional POSTS made to submit parameters
// and retrieve data. For this sample, we'll just
// echo the results.
echo $data;
/************************************************
* that's it! Close the curl handle
************************************************/
curl_close($ch);
?>
CABECERA
Código:
Espero que me puedan dar una mano ya que no puedo hacer el login. me esta volviendo loco https://sso.personal.com.ar/openam/UI/Login POST /openam/UI/Login HTTP/1.1 Host: sso.personal.com.ar User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: es-ar,es;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Referer: https://autogestion.personal.com.ar/Individuos/index.aspx Cookie: JSESSIONID=8AF8677AC18E94F5A4EA5868015E0AC1; TS52869c=6a0cf8999894631d37a0679a2f0f8a2506d6702bce25bb8452d81cbd; __utma=146248757.1570333847.1377892189.1377892189.1377892189.1; __utmz=146248757.1377892189.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); clubpersonal_cookie=24.232.199.132; TS5c9195=6a0cf8999894631d37a0679a2f0f8a2506d6702bce25bb8452d81cbd; amlbcookie=01; iPlanetDirectoryPro=AQIC5wM2LY4Sfcw8ZY7IS696c_stzBIRrd5Buu1DaEiwhT8.*AAJTSQACMDIAAlMxAAIwMQ..* Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 689 __LASTFOCUS=&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwULLTIxNDY1NDg1ODQPZBYCZg9kFgICAg9kFgICBQ9kFgQCBw8WAh4FY2xhc3MFB29jdWx0YXIWAmYPZBYCZg9kFgJmDw8WAh4ISW1hZ2VVcmxlFgIfAAUHb2N1bHRhcmQCCQ8PFgIeB1Zpc2libGVoZGRk4fvsOs%2Buznn9WVTXkbncT90vjQE%3D&__EVENTVALIDATION=%2FwEWBQKX3YiQBQLax5j4DgK%2B%2BMCHCgK%2BnZHxBALWjZjDDa95dvCznHHJeCFwT7fCtKBTr3G7&buscar=&ctl00%24LogueoPropio%24TxtArea=351&ctl00%24LogueoPropio%24TxtLinea=3390903&ctl00%24LogueoPropio%24TxtPin=1002&IDToken3=&goto=https%3A%2F%2Fautogestion.personal.com.ar%2FIndividuos%2Fdefault.aspx&gotoOnFail=https%3A%2F%2Fautogestion.personal.com.ar%2FIndividuos%2FRespuesta.aspx&realm=%2Fservicios&IDToken1=3513390903&IDToken2=1002 HTTP/1.1 302 Moved Temporarily X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1 Cache-Control: private Set-Cookie: JSESSIONID=99A4B69FF1F9EE8518CED099DD01541B; Path=/openam Set-Cookie: AMAuthCookie=AQIC5wM2LY4SfczdRIE_WZr9njkGI4ewaLvZHrlho9I0ZSk.*AAJTSQACMDIAAlMxAAIwMw..*; Domain=.personal.com.ar; Path=/ Set-Cookie: amlbcookie=03; Domain=.personal.com.ar; Path=/ Set-Cookie: iPlanetDirectoryPro=AQIC5wM2LY4SfczdRIE_WZr9njkGI4ewaLvZHrlho9I0ZSk.*AAJTSQACMDIAAlMxAAIwMw..*; Domain=.personal.com.ar; Path=/ Set-Cookie: AMAuthCookie=LOGOUT; Domain=.personal.com.ar; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/ Set-Cookie: TS5c9195=09d54bed8742dce93cebc1cf08651ca606d6702bce25bb8452d826f0; Path=/ Set-Cookie: TS52869c=6a0cf8999894631d37a0679a2f0f8a2506d6702bce25bb8452d81cbd; Path=/openam Pragma: no-cache Expires: 0 X-DSAMEVersion: (2011-March-02 18:42) AM_CLIENT_TYPE: genericHTML X-AuthErrorCode: 0 Location: https://autogestion.personal.com.ar/Individuos/default.aspx Content-Length: 0 Date: Thu, 16 Jan 2014 18:37:35 GMT ----------------------------------------------------------
gracias y saludos!