I have a script that replicates a human on a message board, and its logs
(logging in, going to inventory, etc.) occur every 12 (no more no less)
seconds. Do you know why?
function sendreq($addy,$type,$content = ,$cookie =
,$useragent=,$host=---) {
$msg = strtoupper($type); // get or post
$msg .= ;
$msg .= $addy;
$msg .= HTTP/1.1\r\n;
$msg .= Host: $host\r\n;
$msg .= User-agent: $useragent\r\n;
if($cookie != ) $msg .= Cookie: $cookie\r\n;
if (strtolower($type) == 'post') {
$msg .= Content-type: application/x-www-form-urlencoded\r\n;
$msg .= Content-length: ;
$msg .= strlen($content);
$msg .= \r\n\r\n;
$msg .= $content;
} else {
$msg .= \r\n;
}
//message is prepared!
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp) {
die($errstr ($errno)br\n);
} else {
fputs ($fp, $msg);
while (!feof($fp)) {
$result.= fgets ($fp);
}
fclose ($fp);
}
return $result;
}
function extractcookie($result) {
preg_match_all(!Set-Cookie: (.*);!,$result,$matches);
$matches = $matches[1];
return $matches[count($matches)-1];
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php