Merge pull request #3101 from phl0/lotwFixing

Lotw fixing
这个提交包含在:
Peter Goodhall 2024-05-13 20:22:28 +01:00 提交者 GitHub
当前提交 314c42e095
找不到此签名对应的密钥
GPG 密钥 ID: B5690EEEBB952194

查看文件

@ -297,23 +297,13 @@ class Lotw extends CI_Controller {
//Tell cURL to return the output as a string. //Tell cURL to return the output as a string.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//If the function curl_file_create exists
if(function_exists('curl_file_create')){
//Use the recommended way, creating a CURLFile object. //Use the recommended way, creating a CURLFile object.
$filePath = curl_file_create($filePath); $uploadfile = curl_file_create($filePath);
} else{ $uploadfile->setPostFilename(basename($filePath));
//Otherwise, do it the old way.
//Get the canonicalized pathname of our file and prepend
//the @ character.
$filePath = '@' . realpath($filePath);
//Turn off SAFE UPLOAD so that it accepts files
//starting with an @
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
//Setup our POST fields //Setup our POST fields
$postFields = array( $postFields = array(
$uploadFieldName => $filePath $uploadFieldName => $uploadfile
); );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
@ -967,7 +957,7 @@ class Lotw extends CI_Controller {
openssl_free_key($pkeyid); openssl_free_key($pkeyid);
} }
$signature_b64 = base64_encode($signature); $signature_b64 = base64_encode($signature);
return $signature_b64; return $signature_b64."\n";
} }