I had
exec(
"curl".
" --cert $this->_cCertifikatZPKomunikace".
" --cacert $this->_cCertifikatPortalCA".
" --data \"request=".urlencode($fc_xml)."\"".
" --output $lc_filename_stdout".
" $this->_cPortalURL".
" 2>$lc_filename_stderr",
$la_dummy,$ln_RetCode
);
in php.
I have to do it via java. Can you help me?
Thanks Jakub
I use the HttpClient methods:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
like so:
HttpClient client = new HttpClient();
HttpMethod method = new GetMethod("http://www.google.com");
int responseCode = client.executeMethod(method);
if (responseCode != 200) {
throw new HttpException("HttpMethod Returned Status Code: " + responseCode + " when attempting: " + url);
}
String rtn = StringEscapeUtils.unescapeHtml(method.getResponseBodyAsString());
EDIT: Oops. StringEscapeUtils comes from commons-lang. http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With