Skip to content

Commit

Permalink
增加原始数据
Browse files Browse the repository at this point in the history
  • Loading branch information
git committed Oct 28, 2021
1 parent 9a88b0e commit f823e99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/guanyierp.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class guanyierp
private $_error; //详细代码信息
private $_errno; //出错代码编号
public $orgi; //原始数据
public $body;
public $total; //内容的总数量

/**
Expand Down Expand Up @@ -52,6 +53,11 @@ public function error($no = false)
return $this->get($no ? '_errno' : '_error');
}

public function getErr($no = false)
{
return $this->error($no);
}

//设置正常状态
public function setOK()
{
Expand Down Expand Up @@ -232,7 +238,7 @@ public function webPost($url = null)
$this->sign();
}
if (1) {
$body = $this->url('POST', $url, urlencode($this->jsonEncodeCh($this->data)), ['header' => ['Content-Type:text/json;charset=utf-8']]);
$this->body = $this->url('POST', $url, urlencode($this->jsonEncodeCh($this->data)), ['header' => ['Content-Type:text/json;charset=utf-8']]);
} else {
$data_string = $this->jsonEncodeCh($this->data);
echo 'request: ' . $data_string . "\n";
Expand All @@ -246,10 +252,10 @@ public function webPost($url = null)
'Content-Type:text/json;charset=utf-8',
'Content-Length:' . strlen($data_string)
));
$body = curl_exec($ch);
$this->body = curl_exec($ch);
curl_close($ch);
}
$meta = json_decode($body, true);
$meta = json_decode($this->body, true);
if (!$meta) {
$this->setErr('Response is not json format', 500);
return false;
Expand Down
11 changes: 9 additions & 2 deletions src/guanyiweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class guanyiweb
private $_error; //详细代码信息
private $_errno; //出错代码编号
public $orgi; //原始数据
public $body;
public $total; //内容的总数量
public $url;
public $path;
Expand Down Expand Up @@ -83,6 +84,12 @@ public function error($no = false)
return $this->get($no ? '_errno' : '_error');
}


public function getErr($no = false)
{
return $this->error($no);
}

//设置正常状态
public function setOK()
{
Expand Down Expand Up @@ -159,8 +166,8 @@ public function webPost($url = null)
$header[] = "Referer: " . $this->url;
$header[] = "Cookie: " . $this->cookie;
if(isset($this->config['User-Agent']) && $this->config['User-Agent'])$header[] = "User-Agent: " . $this->config['User-Agent'];
$body = $this->url('POST', $this->url, $this->data, ['header' => $header]);
$meta = json_decode($body, true);
$this->body = $this->url('POST', $this->url, $this->data, ['header' => $header]);
$meta = json_decode($this->body, true);
if (!$meta) {
$this->setErr('Response is not json format', 500);
return false;
Expand Down

0 comments on commit f823e99

Please sign in to comment.