<?php
$header = array(
'Accept: application/json',
'Authorization: Bearer <KEY API HERE>',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<WEB HERE>');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
if(curl_errno($ch)){
return 'Request Error:' . curl_error($ch);
}
echo $result;
?>
有人可以帮助我将此代码翻译为Java程序(netbeans)吗? 我是cURL代码php中的新手