注意::改完重啟守護(hù)進(jìn)程
1、文件地址:crmeb/services/express/storage/Express.php
行數(shù) 202 行左右,
方法名:temp()
如下如圖把 POST 改成 GET
2、crmeb/services/HttpService.php
行數(shù):81 行左右
方法:request()
復(fù)制以下代碼,替換次方法
public static function request($url, $method = 'get', $data = array(), $header = false, $timeout = 15)
{
self::$status = null;
self::$curlError = null;
self::$headerStr = null;
$curl = curl_init($url);
$method = strtoupper($method);
//請(qǐng)求方式
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
//post請(qǐng)求
if ($method == 'POST') {
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
} elseif ($method == 'GET' && count($data)) {
$url .= '?' . http_build_query($data);
curl_setopt($curl, CURLOPT_URL, $url);
}
//超時(shí)時(shí)間
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
//設(shè)置header頭
if ($header !== false) curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
//返回抓取數(shù)據(jù)
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//輸出header頭信息
curl_setopt($curl, CURLOPT_HEADER, true);
//TRUE 時(shí)追蹤句柄的請(qǐng)求字符串,從 PHP 5.1.3 開(kāi)始可用。這個(gè)很關(guān)鍵,就是允許你查看請(qǐng)求header
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
//https請(qǐng)求
if (1 == strpos("$" . $url, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
self::$curlError = curl_error($curl);
[$content, $status] = [curl_exec($curl), curl_getinfo($curl), curl_close($curl)];
self::$status = $status;
self::$headerStr = trim(substr($content, 0, $status['header_size']));
$content = trim(substr($content, $status['header_size']));
return (intval($status["http_code"]) === 200) ? $content : false;
}