简体   繁体   English

如何使用Ajax从网页上使用httpclient 4.3.x获取信息

[英]how to use httpclient 4.3.x grabbing infomation from web page with ajax

for example,grab full content from https://play.google.com/store/apps 例如,从https://play.google.com/store/apps获取全部内容

I found it posts data: 我发现它发布了数据:

"start=15&num=5&numChildren=10pagTok=CA8QDxjh2ND3psHQ4pcB%3AS%3AANO1ljLBy5U&ipf=1&xhr=1" “开始= 15&num = 5&numChildren = 10pagTok = CA8QDxjh2ND3psHQ4pcB%3AS%3AANO1ljLBy5U&ipf = 1&xhr = 1”

to show next browser page then I used 显示下一个浏览器页面,然后我用

  HttpPost httpPost = new HttpPost("https://play.google.com/store/apps");
  List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("start","15"));
    params.add(new BasicNameValuePair("num","5"));
    params.add(new BasicNameValuePair("numChildren","10"));
    params.add(new BasicNameValuePair("pagTok","CA8QDxjh2ND3psHQ4pcB"));
    params.add(new BasicNameValuePair("ipf","1"));
    params.add(new BasicNameValuePair("xhr","1"));

    httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
    CloseableHttpResponse response = getSSLHttpClient().execute(httpPost);
    HttpEntity entity = response.getEntity();
    try {
        if(entity != null) {
            return EntityUtils.toString(entity);
        }
    } finally {
        EntityUtils.consume(entity);
        response.close();
    }

but in the end I can't get the web document from googleplay,the result is some javascript, what's wrong? 但是最后我无法从googleplay获取网络文档,结果是一些javascript,怎么了?

Apache HTTP Client is used to get the page content. Apache HTTP Client用于获取页面内容。 If you need to execute javascript on this page you can use HtmlUnit . 如果您需要在此页面上执行javascript,则可以使用HtmlUnit Here is an example 是一个例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用非ASCII凭据在httpclient 4.3.x中不起作用 - Use of non-ascii credentials not working in httpclient 4.3.x apache httpclient 4.4:HostnameVerifier从4.3.x过渡 - apache httpclient 4.4: HostnameVerifier transition from 4.3.x 使用 4.3.x 重用 HttpClient 连接 - HttpClient connection reusing with 4.3.x 在HttpClient 4.3.x中更正基本身份验证 - Correct Basic Authentication in HttpClient 4.3.x HttpClient 4.3.x,修复不推荐使用的代码以使用当前的 HttpClient 实现 - HttpClient 4.3.x, fixing deprecated code to use current HttpClient implementations 如何在httpClient 4.3.x中强制http客户端不自动处理身份验证挑战? - How to force the http client to not handle the authentication challenges automatically in httpClient 4.3.x? 使用HttpClient 4.3.x,为特定URL执行HttpHead会产生NoHttpResponseException - With HttpClient 4.3.x, executing a HttpHead for a specific URL gives NoHttpResponseException 将Apache httpcomponents从4.1.x升级到4.3.x - Upgrade Apache httpcomponents from 4.1.x to 4.3.x 带有Hibernate 4.3.x的BoneCP - BoneCP with Hibernate 4.3.x 获取Apache httpconents HttpClient 4.3.x OSGi包以解决Apache Karaf 2.3.x的问题 - Problems with getting Apache httpcomponents HttpClient 4.3.x OSGi bundle to work on Apache Karaf 2.3.x
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM