Código PHP:
$url = "http://www.malwarebytes.org/forums/index.php?act=Login&CODE=01";
$postfields = 'UserName=Einstein&PassWord=pt66ypjx';
$options = array(
CURLOPT_RETURNTRANSFER => true, // devuelve la web
CURLOPT_HEADER => true, // devuelve los headers de la web
CURLOPT_FOLLOWLOCATION => false, // sigue redirecciones (por ej, si al iniciar curl es direccionado a otra web)
CURLOPT_ENCODING => "", // soportar todos los "encodings"
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 7.00; Windows NT 5.0)", // el agente (datos sobre navegador)
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // el timeout para realizar la coneccion
CURLOPT_TIMEOUT => 120, // el timeout de respuesta de la web
CURLOPT_MAXREDIRS => 10, // maxima cantidad de redirecciones
CURLOPT_POST => 2, //campos post
CURLOPT_POSTFIELDS => "$postfields", // datos post
CURLOPT_COOKIEFILE => "cookies.txt", // de donde leer cookies
CURLOPT_COOKIEJAR => "cookies.txt" // en donde guardar cookies
);
$ch = curl_init($url); // inicia el curl dando la web
curl_setopt_array($ch, $options); // setea las opciones
$content = curl_exec($ch); // executa la operacion curl y devuelve el contenido de la web en "$content"
curl_close($ch); // cierra operacion
// Aca podriamos preguntarnos si algun tipo de señal en el codigo html nos confirma el login, si es asi, procedemos a la proxima parte..
$url = "http://www.malwarebytes.org/forums/index.php?showforum=58";
$postfields = 'posts=allusers';
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_ENCODING => "",
CURLOPT_USERAGENT => "Mozilla/4.0 (compatible; MSIE 7.00; Windows NT 5.0)",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POST => 2,
CURLOPT_POSTFIELDS => "$postfields", // datos post
CURLOPT_COOKIEFILE => "cookies.txt", // de donde leer cookies anteriormente guardadas
CURLOPT_COOKIEJAR => "cookies.txt" // en donde guardar cookies
);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$content = curl_exec($ch);
curl_close($ch);
$text = $content;
echo $text;