echo headers("POST", "www.neopets.com", "/login.phtml", "Referer: http://www.neopets.com/hi.phtml", "username=user&password=pass&destination=%2Findex.phtml");
function headers($method, $file, $host, $referer = "", $data = "") {
$isPost = stripos($method, "POST") !== FALSE;
$headers = ($isPost ? "POST " : "GET ").$file." HTTP/1.1\r\n";
$headers .= "Host: ".$host."\r\n";
$headers .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3\r\n";
$headers .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
$headers .= "Accept-Language: en-us,en;q=0.5\r\n";
$headers .= "Accept-Encoding: gzip,deflate\r\n";
$headers .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n";
$headers .= "Keep-Alive: 115\r\n";
$headers .= "Connection: keep-alive\r\n";
if(isSet($referer)) {
$headers .= $referer."\r\n";
}
if($isPost) {
$headers .= "Content-Type: application/x-www-form-urlencoded\r\n";
$headers .= "Content-Length: ".strlen($data)."\r\n";
}
if(isSet($this->Cookie)) {
$headers .= $this->Cookie."\r\n\r\n";
} else {
$headers .= "\r\n\r\n";
}
if($isPost) {
$headers .= $data;
}
return $headers;
}
Here's what it echoes:
POST www.neopets.com HTTP/1.1 Host: /login.phtml User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://www.neopets.com/hi.phtml Content-Type: application/x-www-form-urlencoded Content-Length: 54 username=user&password=pass&destination=%2Findex.phtmlAnd when I replace "user" with my username, I get this:
I'm really stuckError: No username found! Please go back and re-enter your username.
Edited by Zeeknon, 28 May 2010 - 09:43 PM.