I'm trying to make a request using curl with php, but I'm getting the following error. Could I be using curl wrong? I generate $jwt on top lines
exec("curl -v -H 'Authorization: Bearer $jwt' \"https://api.storekit.itunes.apple.com/inApps/v1/refund/lookup/1234\"")
Could not resolve host: Bearer
This is how I can use it on this site apple
CodePudding user response:
You can use curl like this
<?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);