我正在尝试将图像上传到 java 中的 imagezilla.net。用 php 使用 curl 没问题..
$pvars = array('file' => "@".$imagePath, 'apikey' => "apikey");
$timeout = 30;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://imagezilla.net/api.php');
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
$xml = curl_exec($curl);
curl_close ($curl);
$res = new SimpleXMLElement($xml);
怎么可能在java中做到这一点?