On Oct 25, 8:34*pm, Ed Mullen <e... (AT) edmullen (DOT) net> wrote:
Quote:
Anonymous Number of People wrote:
Thanks for any ideas!
Here's one: *Start taking your meds again.
--
Ed Mullenhttp://edmullen.net
A Messy Kitchen Is A Happy Kitchen And This Kitchen Is Delirious |
Did you stop?
48461605353720564221010588564136043721670963547235 972627911758761795246277798557
09387236097164263497502522313635622300675998398474 684181617086688598031152276727
Zl)) {
logToFile("reply.txt", $hname.": ".$val);
if($header_name == "set-cookie") {
header($hname.": ".$val, false);
} else {
header($hname.": ".$val, true);
}
} else {
if($header_name == 'content-length') {
header("$hname: 0", true);
logToFile("reply.txt", "$hname: 0");
} else {
logToFile("reply.txt", $header_name);
header($header_name, true);
}
}
}
}
} /*else {
if($header_name != 'transfer-encoding' && $header_name != 'x-
powered-by' && $header_name != 'connection' && $header_name != 'keep-
alive') {
if(!empty($headers[$header_name])) {
logToFile("reply.txt", $header_name.": ".$headers
[$header_name]);
header($header_name.": ".$headers[$header_name], true);
} else {
logToFile("reply.txt", $header_name);
header($header_name, true);
}
}
}*/
}
logToFile("reply.txt", "-----------------");
for(;

{
$error=$http->ReadReplyBody($body,1000);
if($error!="" || strlen($body)==0)
break;
echo $body;
flush();
}
}
l)) {
logToFile("reply.txt", $hname.": ".$val);
if($header_name == "set-cookie") {
header($hname.": ".$val, false);
} else {
header($hname.": ".$val, true);
}
} else {
if($header_name == 'content-length') {
header("$hname: 0", true);
logToFile("reply.txt", "$hname: 0");
} else {
logToFile("reply.txt", $header_name);
header($header_name, true);
}
}
}
}
} /*else {
if($header_name != 'transfer-encoding' && $header_name != 'x-
powered-by' && $header_name != 'connection' && $header_name != 'keep-
alive') {
if(!empty($headers[$header_name])) {
logToFile("reply.txt", $header_name.": ".$headers
[$header_name]);
header($header_name.": ".$headers[$header_name], true);
} else {
logToFile("reply.txt", $header_name);
header($header_name, true);
}
}
}*/
}
logToFile("reply.txt", "-----------------");
for(;

{
$error=$http->ReadReplyBody($body,1000);
if($error!="" || strlen($body)==0)
break;
echo $body;
flush();
}
}
/*$http->SaveCookies($site_cookies);
if(!empty($site_cookies)) {
@file_put_contents("cook.dat", serialize($site_cookies));
}*/
$http->Close();
}
if(strlen($error))
echo "<CENTER><H2>Error: ",$error,"</H2><CENTER>\n";
exit(0);
################################################## ###
function cookieEncode($str) {
return str_replace(array(' ',
"\t",
';',
','),
array('%20',
'%09',
'%3B',
'%2C'),
$str);
}
function cookieDecode($str) {
return str_replace(array('%20',
'%09',
'%3B',
'%2C'),
array(' ',
"\t",
';',
','),
$str);
}
function cenc2() {
$qs = "";
if (@sizeof(array_values($_COOKIE)) > 0) {
foreach ($_COOKIE as $key => $val) {
if (is_array($val) || is_object($val)) {
$qs .= "$key=" . rawurlencode(serialize($val)) + "; ";
} else {
//if(preg_match("/\\;|\\=/", $val)) $val = rawurlencode($val);
//$val = cenc($val, 0);
$key = cookieEncode($key);
$val = cookieEncode($val);
$qs .= "$key=$val; ";
}
}
}
$qs = rtrim($qs, "; ");
return $qs;
}
function set_post_vars($array, $parent_key = null) {
$temp = array();
foreach ($array as $key => $value) {
$key = isset($parent_key) ? sprintf('%s[%s]', $parent_key,
($key)) : ($key);
if (is_array($value)) {
$temp = array_merge($temp, set_post_vars($value, $key));
} else {
$temp[$key] = ($value);
}
}
return $temp;
}
function logToFile($filename, $msg) {
if(!$DEBUG) return;
// open file
$fd = fopen($filename, "a");
// append date/time to message
$str = "[" . date("Y/m/d h:i:s", mktime()) . "] " . $msg;
// write string
fwrite($fd, $str . "\n");
// close file
fclose($fd);
}
class http_class
{
var $host_name="";
var $host_port=0;
var $proxy_host_name="";
var $proxy_host_port=80;
var $socks_host_name = '';
var $socks_host_port = 1080;
var $protocol="http";
var $request_method="GET";
var $user_agent='httpclient';
var $authentication_mechanism="";
var $user;
var $password;
var $realm;
var $workstation;
var $proxy_authentication_mechanism="";
var $proxy_user;
var $proxy_password;
var $proxy_realm;
var $proxy_workstation;
var $request_uri="";
var $request="";
var $request_headers=array();
var $request_user;
var $request_password;
var $request_realm;
var $request_workstation;
var $proxy_request_user;
var $proxy_request_password;
var $proxy_request_realm;
var $proxy_request_workstation;
var $request_body="";
var $request_arguments=array();
var $protocol_version="1.1";
var $timeout=0;
var $data_timeout=0;
var $debug=0;
var $debug_response_body=1;
var $html_debug=0;
var $support_cookies=1;
var $cookies=array();
var $error="";
var $exclude_address="";
var $follow_redirect=0;
var $redirection_limit=5;
var $response_status="";
var $response_message="";
var $file_buffer_length=8000;
var $force_multipart_form_post=0;
var $prefer_curl = 0;
/* public variables - PLEASE ACCESS */
var $state="Disconnected";
var $use_curl=0;
var $connection=0;
var $content_length=0;
var $response="";
var $read_response=0;
var $read_length=0;
var $request_host="";
var $next_token="";
var $redirection_level=0;
var $chunked=0;
var $remaining_chunk=0;
var $last_chunk_read=0;
var $months=array(
"Jan"=>"01",
"Feb"=>"02",
"Mar"=>"03",
"Apr"=>"04",
"May"=>"05",
"Jun"=>"06",
"Jul"=>"07",
"Aug"=>"08",
"Sep"=>"09",
"Oct"=>"10",
"Nov"=>"11",
"Dec"=>"12");
var $session='';
var $connection_close=0;
/* PUBLIC methods _ PLEASE CALL */
Function Tokenize($string,$separator="")
{
if(!strcmp($separator,""))
{
$separator=$string;
$string=$this->next_token;
}
for($character=0;$character<strlen($separator);$ch aracter++)
{
if(GetType($position=strpos($string,$separator[$character]))
=="integer")
$found=(IsSet($found) ? min($found,$position) : $position);
}
if(IsSet($found))
{
$this->next_token=substr($string,$found+1);
return(substr($string,0,$found));
}
else
{
$this->next_token="";
return($string);
}
}
Function CookieEncode($value, $name)
{
return($name ? str_replace("=", "%25", $value) : str_replace(";",
"%3B", $value));
}
Function SetError($error)
{
return($this->error=$error);
}
Function SetPHPError($error, &$php_error_message)
{
if(IsSet($php_error_message)
&& strlen($php_error_message))
$error.=": ".$php_error_message;
return($this->SetError($error));
}
Function SetDataAccessError($error,$check_connection=0)
{
$this->error=$error;
if(!$this->use_curl
&& function_exists("socket_get_status"))
{
$status=socket_get_status($this->connection);
if($status["timed_out"])
$this->error.=": data access time out";
elseif($status["eof"])
{
if($check_connection)
$this->error="";
else
$this->error.=": the server disconnected";
}
}
}
Function OutputDebug($message)
{
$message.="\n";
if($this->html_debug)
$message=str_replace("\n","<br />\n",HtmlEntities($message));
echo $message;
flush();
}
Function GetLine()
{
for($line="";

{
if($this->use_curl)
{
$eol=strpos($this->response,"\n",$this->read_response);
$data=($eol ? substr($this->response,$this->read_response,$eol
+1-$this->read_response) : "");
$this->read_response+=strlen($data);
}
else
{
if(feof($this->connection))
{
$this->SetDataAccessError("reached the end of data while
reading from the HTTP server connection");
return(0);
}
$data=fgets($this->connection,100);
}
if(GetType($data)!="string"
$this->SetDataAccessError("it was not possible to read line
from the HTTP server");
return(0);
}
$line.=$data;
$length=strlen($line);
if($length
&& !strcmp(substr($line,$length-1,1),"\n"))
{
$length-=(($length>=2 && !strcmp(substr($line,
$length-2,1),"\r")) ? 2 : 1);
$line=substr($line,0,$length);
if($this->debug)
$this->OutputDebug("S $line");
return($line);
}
}
}
Function PutLine($line)
{
if($this->debug)
$this->OutputDebug("C $line");
if(!fputs($this->connection,$line."\r\n"))
{
$this->SetDataAccessError("it was not possible to send a line to
the HTTP server");
return(0);
}
return(1);
}
Function PutData(&$data)
{
if(strlen($data))
{
if($this->debug)
$this->OutputDebug("C $data");
if(!fputs($this->connection,$data))
{
$this->SetDataAccessError("it was not possible to send data to
the HTTP server");
return(0);
}
}
return(1);
}
Function FlushData()
{
if(!fflush($this->connection))
{
$this->SetDataAccessError("it was not possible to send data to
the HTTP server");
return(0);
}
return(1);
}
Function ReadChunkSize()
{
if($this->remaining_chunk==0)
{
$debug=$this->debug;
if(!$this->debug_response_body)
$this->debug=0;
$line=$this->GetLine();
$this->debug=$debug;
if(GetType($line)!="string")
return($this->SetError("4 could not read chunk start: ".$this-
Quote:
error));
$this->remaining_chunk=hexdec($line);
|
}
return("");
}
Function ReadBytes($length)
{
if($this->use_curl)
{
$bytes=substr($this->response,$this->read_response,min
($length,strlen($this->response)-$this->read_response));
$this->read_response+=strlen($bytes);
if($this->debug
&& $this->debug_response_body
&& strlen($bytes))
$this->OutputDebug("S ".$bytes);
}
else
{
if($this->chunked)
{
for($bytes="",$remaining=$length;$remaining

{
if(strlen($this->ReadChunkSize()))
return("");
if($this->remaining_chunk==0)
{
$this->last_chunk_read=1;
break;
}
$ask=min($this->remaining_chunk,$remaining);
$chunk=@fread($this->connection,$ask);
$read=strlen($chunk);
if($read==0)
{
$this->SetDataAccessError("it was not possible to read data
chunk from the HTTP server");
return("");
}
if($this->debug
&& $this->debug_response_body)
$this->OutputDebug("S ".$chunk);
$bytes.=$chunk;
$this->remaining_chunk-=$read;
$remaining-=$read;
if($this->remaining_chunk==0)
{
if(feof($this->connection))
return($this->SetError("reached the end of data while
reading the end of data chunk mark from the HTTP server"));
$data=@fread($this->connection,2);
if(strcmp($data,"\r\n"))
{
$this->SetDataAccessError("it was not possible to read
end of data chunk from the HTTP server");
return("");
}
}
}
}
else
{
$bytes=@fread($this->connection,$length);
if(strlen($bytes))
{
if($this->debug
&& $this->debug_response_body)
$this->OutputDebug("S ".$bytes);
}
else
$this->SetDataAccessError("it was not possible to read data
from the HTTP server", $this->connection_close);
}
}
return($bytes);
}
\ Function EndOfInput()
{
if($this->use_curl)
return($this->read_response>=strlen($this->response));
if($this->chunked)
return($this->last_chunk_read);
return(feof($this->connection));
}
Function Resolve($domain, &$ip, $server_type)
{
if(ereg('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$',
$domain))
$ip=$domain;
else
{
if($this->debug)
$this->OutputDebug('Resolving '.$server_type.' server domain "'.
$domain.'"...');
if(!strcmp($ip=@gethostbyname($domain),$domain))
$ip="";
}
if(strlen($ip)==0
Quote:
| (strlen($this->exclude_address)
&& !strcmp(@gethostbyname($this->exclude_address),$ip)))
|
return($this->SetError("could not resolve the host domain \"".
$domain."\""));
return('');
}
Function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP')
{
$domain=$host_name;
$port = $host_port;
if(strlen($error = $this->Resolve($domain, $ip, $server_type)))
return($error);
if(strlen($this->socks_host_name))
{
$host_ip = $ip;
$port = $this->socks_host_port;
$host_server_type = $server_type;
$server_type = 'SOCKS';
if(strlen($error = $this->Resolve($this->socks_host_name, $ip,
$server_type)))
return($error);
}
if($this->debug)
$this->OutputDebug('Connecting to '.$server_type.' server IP '.
$ip.' port '.$port.'...');
if($ssl)
$ip="ssl://".$ip;
if(($this->connection=($this->timeout ? @fsockopen($ip, $port,
$errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0)
{
switch($errno)
{
case -3:
return($this->SetError("-3 socket could not be created"));
case -4:
return($this->SetError("-4 dns lookup on hostname \"".
$host_name."\" failed"));
case -5:
return($this->SetError("-5 connection refused or timed
out"));
case -6:
return($this->SetError("-6 fdopen() call failed"));
case -7:
return($this->SetError("-7 setvbuf() call failed"));
default:
return($this->SetPHPError($errno." could not connect to the
host \"".$host_name."\"",$php_errormsg));
}
}
else
{
if($this->data_timeout
&& function_exists("socket_set_timeout"))
socket_set_timeout($this->connection,$this->data_timeout,0);
if(strlen($this->socks_host_name))
{
if($this->debug)
{
$this->OutputDebug('Connected to the SOCKS server '.$this-
Quote:
socks_host_name);
$this->OutputDebug('Negotiating the authentication
|
method ...');
}
$send_error = 'it was not possible to send data to the SOCKS
server';
$receive_error = 'it was not possible to receive data from the
SOCKS server';
$version = 5;
$methods = 1;
$method = 0;
if(!fputs($this->connection, chr($version).chr($methods).chr
($method)))
$error = $this->SetDataAccessError($send_error);
else
{
$response = fgets($this->connection, 3);
if(strlen($response) != 2)
$error = $this->SetDataAccessError($receive_error);
elseif(Ord($response[1]) != $method)
$error = 'the SOCKS server requires an authentication
method that is not yet supported';
else
{
if($this->debug)
$this->OutputDebug('Connecting to '.$host_server_type.'
server IP '.$host_ip.' port '.$host_port.'...');
$command = 1;
$address_type = 1;
if(!fputs($this->connection, chr($version).chr
($command)."\x00".chr($address_type).pack('Nn', ip2long($host_ip),
$host_port)))
$error = $this->SetDataAccessError($send_error);
else
{
$response = fgets($this->connection, 11);
if(strlen($response) != 10)
$error = $this->SetDataAccessError($receive_error);
else
{
$socks_errors = array(
"\x00"=>'',
"\x01"=>'general SOCKS server failure',
"\x02"=>'connection not allowed by ruleset',
"\x03"=>'Network unreachable',
"\x04"=>'Host unreachable',
"\x05"=>'Connection refused',
"\x06"=>'TTL expired',
"\x07"=>'Command not supported',
"\x08"=>'Address type not supported'
);
$error_code = $response[1];
$error = (IsSet($socks_errors[$error_code]) ?
$socks_errors[$error_code] : 'unknown');
if(strlen($error))
$error = 'SOCKS error: '.$error;
}
}
}
}
if(strlen($error))
{
fclose($this->connection); \\\\\\\\////////
return($error); \\ m e a m i//
} \\________//
} \\______//
if($this->debug) [m][m][m]
$this->OutputDebug("Connected to $host_name"); /\/\
if(strlen($this->proxy_host_name)HTTP://MEAMI.ORG -WWW.//\\
&&
s2836005279634781108873419763645164305515147952968 8054684069274257897004720850858
26145452462631429540732852782816160263430911490872 894001502426047070390961878042
05054318561716151220662317166668718757101508808649 746965125304112418261524281273
03960530927905816565924917186528218714394921110766 440713262029719408803207124665
42342136482385949512481270053930281232769798075700 908201337341935583822292462527
88647564899109974936502395771607346428618304603175 555599107481508933295885443472
05096222768030775849825542729689476839012213167032 851629154589026644665464538815
81986963830865813052226426724552464725431061310829 855738886141637201668621081437
18477262370549772977827623810679084635829913290310 521666916754117621260277242014
82684043946027207446633498220929409746833561409027 708400270004452976824403473708
28639806760157956120204837322218360100159069085641 350184543880661353666249879726
17145217073750499894121701741688576920788844943379 472595291594050070276888913147
69546623221072784724083301160149384027233606952179 074358885551245313144677437661
79824650626204001549281235248638211738314872927426 303409137837262613583698085046
76779300361990978586055050893978728388987879499444 003227699065497769734977285013
20501884982220952063632400628094650269008406839334 202274797942413607377913340941
36213664547245653641044397844244125881497430514677 750112651540416167936
[517433]