This commit is contained in:
wangjinlei
2025-01-20 09:15:32 +08:00
parent 9dbb52417f
commit 583bc87bbe
3 changed files with 102 additions and 4 deletions

View File

@@ -539,11 +539,13 @@ function myGet($url)
curl_setopt($oCurl, CURLOPT_BINARYTRANSFER, true); //在启用CURLOPT_RETURNTRANSFER时候将获取数据返回
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl); //获取页面各种信息
$err = curl_error($oCurl);
curl_close($oCurl);
if (intval($aStatus["http_code"]) == 200) {
return $sContent;
} else {
return false;
return $err;
// return false;
}
}
@@ -717,7 +719,8 @@ function my_doiToFrag2($data)
}
$doi = str_replace('/', '%2F', $data['refer_doi']);
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
$url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
// $url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
$url = "https://citation.doi.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
$res = myGet($url);
$frag = trim(substr($res, strpos($res, '.') + 1));
$update = [];
@@ -730,7 +733,6 @@ function my_doiToFrag2($data)
if (mb_substr_count($frag, '.') != 3) {
$f = $frag . " Available at: " . PHP_EOL . "http://doi.org/" . $data['refer_doi'];
$update['refer_frag'] = $f;
$update['refer_type'] = "other";
$update['cs'] = 1;
} else {
$res = explode('.', $frag);
@@ -750,6 +752,7 @@ function my_doiToFrag2($data)
}
$p_refer_obj->where('p_refer_id', $data['p_refer_id'])->update($update);
$p_refer_obj->getConnection()->close();
return $res;
}
function bekjournal($str)