我有
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
);
Run Code Online (Sandbox Code Playgroud)
在PHP中.
我必须通过java来做到这一点.你能帮助我吗?
谢谢Jakub
Quo*_*ian 14
我使用HttpClient方法:
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;
Run Code Online (Sandbox Code Playgroud)
像这样:
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());
Run Code Online (Sandbox Code Playgroud)
编辑:哎呀.StringEscapeUtils来自commons-lang.http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html
| 归档时间: |
|
| 查看次数: |
14038 次 |
| 最近记录: |