Código PHP:
<form id="prueba" class="real-form" method="post" action="../carpeta/miarchivo.php" target="_blank">
<input name="usuario" id="usuario" type="text" placeholder="Clave Lada + Número"
title="10 caracteres numéricos"
size="23" maxlength="10"
required pattern="[0-9]{10}" />
<input name="contraseña" type="password" id="contraseña"
placeholder="Contraseña"
size="23" maxlength="8"
required pattern=".+" />
<input type="hidden" name="T" value="2" />
<input type="hidden" name="p" value="../servlet/acceso_contra_mt?T=2" />
<input type="hidden" name="CE" value="0" />
<button class="blueBtn" type="submit">Entrar</button>
<p>
<a href="proceso.php" target="_blank" class="ligaSubrayado">
¿Olvidaste tu contraseña?
</a>
<br>
<span class="nota">¿No tienes cuenta?</span>
<a href="" target="_blank" class="ligaSubrayado">
Regístrate
</a>
</p>
</form>
ahi es donde los usuarios pondran el user y pass y despues los mando curl lo cual es donde se loguearan en la pagina
Código PHP:
<?php
@session_start();
include("inc/class.curl.php");
if(!isset($_POST['usuario']))
if(!isset($_POST['contraseña']))
header("Location: index.html");
$usuario=$_POST['usuario'];
$contreseña=$_POST['contraseña'];
$ahnLabIndicatorFlag= $_POST['ahnLabIndicatorFlag'];
$typeBN = $_POST['typeBN'];
$browserNameAndVersion= $_POST['browserNameAndVersion'];
$languageSelected = $_POST['languageSelected'];
$data = $data = "usuario=".$usuario.
"&contraseña=".$contraseña.
"&ahnLabIndicatorFlag=".$ahnLabIndicatorFlag.
"&typeBN=".$typeBN.
"&browserNameAndVersion=".$browserNameAndVersion.
"&languageSelected=".$languageSelected;
$curl = new xCurl();
$curl->userAgent = "Netscape 5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
$curl->cInit = curl_init();
$curl->referer= "https://www.lawebdelogueo.com/mitelmex/inicio.jsp";
$curl->cookies = dirname(__FILE__) . "/cookies.txt";
$code = $curl->post('https://www.la web de logueo.com/mitelmex/acceso_contra_mt.jsp?USR=$usuario&CVEACC=$contraseña&ce1=0&ce2=7');
$iniciales = trim($curl->buscar($code, "<div class="caja_recibo">,</div>"));
$iniciales = ($iniciales != '') ? $iniciales : '';
$_flowExecutionKey = $curl->buscar($code, 'name="p" value="', '"');
?>
y esto es lo que tengo del curl in
Código PHP:
<?php
# 19/01/2012 :) Curl its simple...
class xCurl{
public $cInit;
public $proxy;
public $proxyport;
public $cookies;
public $userAgent;
public $referer;
public $cookies_str;
public $headers;
public $verbose=false;
public $header=false;
public function __construct(){
$this->proxy = false;
$this->ip = '211.19.59.36';
$this->proxyport = 3128;
}
public function get( $url, $redirect = false ){
curl_setopt($this->cInit, CURLOPT_URL, $url);
if (isset($this->referer))
curl_setopt($this->cInit, CURLOPT_REFERER, $this->referer);
if (isset($this->userAgent))
curl_setopt($this->cInit, CURLOPT_USERAGENT, $this->userAgent);
else
curl_setopt($this->cInit, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($this->cInit, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->cInit, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->cInit, CURLOPT_RETURNTRANSFER, 1);
if ($this->proxy === true){
curl_setopt($this->cInit, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($this->cInit, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->cInit, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($this->cInit, CURLOPT_PROXY, $this->ip);
}
if (isset($this->cookies)){
curl_setopt($this->cInit, CURLOPT_COOKIEJAR, $this->cookies);
curl_setopt($this->cInit, CURLOPT_COOKIEFILE, $this->cookies);
}
if (isset($this->header) && $this->header === true )
curl_setopt($this->cInit, CURLOPT_HEADER, true);
if (isset($this->verbose) && $this->verbose === true )
curl_setopt($this->cInit, CURLOPT_VERBOSE, true);
if($redirect === true){
curl_exec($this->cInit);
$header = curl_getinfo($this->cInit);
return $header['url'];
}
return curl_exec($this->cInit);
}
public function post( $url, $data, $redirect= false ){
curl_setopt($this->cInit, CURLOPT_URL, $url);
curl_setopt($this->cInit, CURLOPT_POST, 1);
curl_setopt($this->cInit, CURLOPT_POSTFIELDS, $data);
if (isset($this->referer))
curl_setopt($this->cInit, CURLOPT_REFERER, $this->referer);
if (isset($this->userAgent))
curl_setopt($this->cInit, CURLOPT_USERAGENT, $this->userAgent);
else
curl_setopt($this->cInit, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($this->cInit, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->cInit, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($this->cInit, CURLOPT_RETURNTRANSFER, 1);
if ($this->proxy === true){
curl_setopt($this->cInit, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($this->cInit, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($this->cInit, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->cInit, CURLOPT_PROXY, $this->ip);
}
if (isset($this->cookies)){
curl_setopt($this->cInit, CURLOPT_COOKIEJAR, $this->cookies);
curl_setopt($this->cInit, CURLOPT_COOKIEFILE, $this->cookies);
curl_setopt($this->cInit, CURLOPT_COOKIE, $this->cookies_str);
}
if (isset($this->headers) ){
curl_setopt($this->cInit, CURLOPT_HTTPHEADER, $this->headers);
}
if (isset($this->header) && $this->header === true )
curl_setopt($this->cInit, CURLOPT_HEADER, true);
if (isset($this->verbose) && $this->verbose === true )
curl_setopt($this->cInit, CURLOPT_VERBOSE, true);
if($redirect === true){
curl_exec($this->cInit);
$header = curl_getinfo($this->cInit);
return $header['url'];
}
return curl_exec($this->cInit);
}
public function buscar( $Code, $ini, $end ){
$pleft = @strpos($Code, $ini, 0);
if ($pleft !== false){
$pright = @strpos($Code, $end, $pleft + strlen($ini));
if ($pright !== false)
return trim( (@substr($Code, $pleft + strlen($ini), ($pright - ($pleft + strlen($ini))))) );
}
return '';
}
public function debug( $input, $txt ){
$f = fopen($txt,"w+");
fwrite($f, $input);
fclose($f);
}
}
?>