我正在尝试将图像上传到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中执行此操作?