$content = "mode=login&chal=c0:1216468800:2495:300:E7hQqy7D7SSujymYaT2h:b38844ffa11fdf08d87fc4812788a686&response=&"; $content .= "user=".$_POST['login']."&password=".$_POST['passwd']."&_submit=Login&remember_me=1"; $req = "POST /login.bml?ret=1 HTTP/1.0\r\n"; $req .= "Accept: */*\r\n"; $req .= "Content-Type: application/x-www-form-urlencoded\r\n"; $req .= "Proxy-Connection: Keep-Alive\r\n"; $req .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; MRA 4.9 (build 01863))\r\n"; $req .= "Host: www.livejournal.com\r\n"; $req .= "Content-Length: ".strlen($content)."\r\n"; $req .= "Pragma: no-cache\r\n\r\n"; $req .= $content; $sock = fsockopen("www.livejournal.com", 80, $errno, $errstr, 30); fwrite($sock, $req); while ( $read = fread($sock, 4096) ) { $res .= $read; } fclose($sock); preg_match_all("/Set-Cookie\: (\S*)=(\S*)(|;)/", $res, $cookie); for ( $i=0; $i<count($cookie[0]); $i++ ) { $cookie[0][$i] = str_replace("Set-Cookie: ", "", $cookie[0][$i]); $cookie[0][$i] = str_replace(";", "", $cookie[0][$i]); if ( !strpos($cookies, $cookie[0][$i]) ) { $cookies .= "Cookie: ".$cookie[0][$i]."\r\n"; } } $req = "GET / HTTP/1.0\r\n"; $req .= "Accept: */*\r\n"; $req .= "Content-Type: application/x-www-form-urlencoded\r\n"; $req .= "Referer: http://www.livejournal.com/login.bml?ret=1\r\n"; $req .= "Proxy-Connection: Keep-Alive\r\n"; $req .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; MRA 4.9 (build 01863))\r\n"; $req .= "Host: www.livejournal.com\r\n"; $req .= $cookies; $req .= "Pragma: no-cache\r\n\r\n"; $sock = fsockopen("www.livejournal.com", 80, $errno, $errstr, 30); fwrite($sock, $req); $res = ""; while ( $read = fread($sock, 4096) ) { $res .= $read; } echo $res; fclose($sock);