연감이 정상 저장되지 않는 문제 해결
This commit is contained in:
+18
-18
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
class HTTP{
|
||||
var $Socket, $Server, $Port, $Timeout, $HttpVersion = "1.0", $Url, $Length, $ResponseTime, $ErrNum, $ErrMsg;
|
||||
var $headers = array();
|
||||
@@ -29,7 +29,7 @@ class HTTP{
|
||||
$this->Url = $Url;
|
||||
$msg = sprintf("HEAD %s HTTP/%s\r\n", $this->Url, $this->HttpVersion);
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
|
||||
return $this->Read();
|
||||
@@ -42,7 +42,7 @@ class HTTP{
|
||||
$msg .= $this->PutCookie($Cookie);
|
||||
}
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
|
||||
return $this->isOK();
|
||||
@@ -52,7 +52,7 @@ class HTTP{
|
||||
$this->Url = $Url;
|
||||
$msg = sprintf("GET %s HTTP/%s\r\n", $this->Url, $this->HttpVersion);
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
$out = $this->ReadHeader();
|
||||
return $out;
|
||||
@@ -65,7 +65,7 @@ class HTTP{
|
||||
$msg .= $this->PutCookie($Cookie);
|
||||
}
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
return $this->Read();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ class HTTP{
|
||||
$msg .= $this->PutCookie($Cookie);
|
||||
}
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
return $this->isOK();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class HTTP{
|
||||
$msg .= $this->PutCookie($Cookie);
|
||||
}
|
||||
$msg .= $this->PutHead();
|
||||
$msg .= "\n\n";
|
||||
$msg .= "\r\n\r\n";
|
||||
fputs($this->Socket, $msg);
|
||||
|
||||
$data = $this->Read();
|
||||
@@ -99,39 +99,39 @@ class HTTP{
|
||||
|
||||
function Post($Url, $Data, $Cookie = ""){
|
||||
$this->Url = $Url;
|
||||
fputs ($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion));
|
||||
fputs($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion));
|
||||
if($Cookie != ""){
|
||||
$this->PutCookie($Cookie);
|
||||
}
|
||||
$this->PutHead();
|
||||
fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n");
|
||||
fputs($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n");
|
||||
$out = "";
|
||||
while (list ($k, $v) = each ($Data)) {
|
||||
if(strlen($out) != 0) $out .= "&";
|
||||
$out .= rawurlencode($k). "=" .rawurlencode($v);
|
||||
}
|
||||
fputs ($this->Socket, "Content-length: ".strlen($out)."\n\n");
|
||||
fputs ($this->Socket, "$out");
|
||||
fputs ($this->Socket, "\n");
|
||||
fputs($this->Socket, "Content-length: ".strlen($out)."\r\n");
|
||||
fputs($this->Socket, "$out");
|
||||
fputs($this->Socket, "\r\n");
|
||||
return $this->Read();
|
||||
}
|
||||
|
||||
function IsPost($Url, $Data, $Cookie = ""){
|
||||
$this->Url = $Url;
|
||||
fputs ($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion));
|
||||
fputs($this->Socket,sprintf("POST %s HTTP/%s\r\n", $this->Url, $this->HttpVersion));
|
||||
if($Cookie != ""){
|
||||
$this->PutCookie($Cookie);
|
||||
}
|
||||
$this->PutHead();
|
||||
fputs ($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n");
|
||||
fputs($this->Socket, "Content-type: application/x-www-form-urlencoded\r\n");
|
||||
$out = "";
|
||||
while (list ($k, $v) = each ($Data)) {
|
||||
if(strlen($out) != 0) $out .= "&";
|
||||
$out .= rawurlencode($k). "=" .rawurlencode($v);
|
||||
}
|
||||
fputs ($this->Socket, "Content-length: ".strlen($out)."\n\n");
|
||||
fputs ($this->Socket, "$out");
|
||||
fputs ($this->Socket, "\n");
|
||||
fputs($this->Socket, "Content-length: ".strlen($out)."\r\n\r\n");
|
||||
fputs($this->Socket, "$out");
|
||||
fputs($this->Socket, "\r\n");
|
||||
return $this->isOk();
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ class HTTP{
|
||||
$chunked = isset($this->Response['transfer-encoding']) && ('chunked' == $this->Response['transfer-encoding']);
|
||||
$gzipped = isset($this->Response['content-encoding']) && ('gzip' == $this->Response['content-encoding']);
|
||||
$body = '';
|
||||
$this->_chunkLength = 0;
|
||||
while(!feof($this->Socket)){
|
||||
if ($chunked) {
|
||||
$buf = $this->_readChunked();
|
||||
@@ -285,4 +286,3 @@ class HTTP{
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user