I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

我正在尝试使用带 php 的 curl 发出请求,但出现以下错误。我可能用错了 curl 吗? 我在顶行生成 $jwt

exec("curl -v -H 'Authorization: Bearer $jwt' \"https://api.storekit.itunes.apple.com/inApps/v1/refund/lookup/1234\"")

Could not resolve host: Bearer

这就是我在这个网站上使用它的方式apple

你可以像这样使用curl

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.storekit.itunes.apple.com/inApps/v1/subscriptions/{original_transaction_id}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');


$headers = array();
$headers[] = 'Authorization: Bearer '. $jwt;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
var_dump($result);
curl_close($ch);