Skip to content

Commit

Permalink
Update Curl.
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJake committed Jan 22, 2024
1 parent 24fb205 commit f69a757
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions application/common/lib/SystemMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static public function fetchIPInfo($ip)
try {
//For Multicast IP use TTL
$info[$v] = Cache::store('flag')->remember($v, function () use ($ip_without_cidr_24) {
$data = json_decode(self::curl_get(self::$url . "$ip_without_cidr_24?fields=country,countryCode&lang="), true);
$data = json_decode(self::curlGet(self::$url . "$ip_without_cidr_24?fields=country,countryCode&lang="), true);
if ($data == null) throw new Exception("Failed to query country code");
return $data;
}, 24 * 60 * 60);
Expand Down Expand Up @@ -102,7 +102,7 @@ static public function timeFormat($time)
]);
}

static private function curl_get($url)
static private function curlGet($url)
{
$header = ['Accept: application/json', 'User-Agent: Mozilla/5.0'];
$curl = curl_init();
Expand All @@ -120,8 +120,8 @@ static private function curl_get($url)
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
//设置获取的信息以文件流的形式返回,而不是直接输出。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, TRUE);
//执行命令
$data = curl_exec($curl);

Expand Down
4 changes: 2 additions & 2 deletions application/common/lib/reCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function validate($response, $ip = ''){
private function post($data) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->recaptcha_url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,TRUE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl,CURLOPT_TIMEOUT, 5);
Expand Down

0 comments on commit f69a757

Please sign in to comment.