function t3_fileopen($server,$port,$path,$server_url,$data,$second)
{
$contents = '';
$fp = @fsockopen($server,$port, $errno, $errstr, $second);
if($fp)
{
if(substr($server,0,6)=="ssl://")$server = substr($server,6);
$write = "POST $path HTTP/1.0\r\n";
$write.= "Host: $server\r\n\r\n";
$write.= "Referer: $server_url\r\n";
$write.= "Content-type: application/x-www-form-urlencoded\r\n";
$write.= "Content-length: " . strlen($data) . "\r\n";
$write.= "\r\n";
$write.= "$data\r\n";
$write.= "\r\n";
fwrite($fp, $write);
while (!feof($fp))
{
$contents .= fread($fp, 8192);
}
$vis = false;
for($i=5;$i<strlen($contents);$i++)
{
if(substr($contents,$i-3,4)=="\r\n\r\n")
{
$vis=true;
$contents = substr($contents,$i+1);
$i = strlen($contents);
}
}
fclose($fp);
}
else
{
$contents = "";
}
return $contents;
}
$file = t3_fileopen('domain.com',80,'/image','my-server.com','login=admin&pass=password',5);