2012-03-28 33 views
1

JSoupを使用してページを開こうとしています。 私が使用してwww.google.comと印刷内容のようなページを開いてみた:Jsoupがhtmlページを開くことができません

Document doc = Jsoup.connect("http://www.google.com").get(); 
System.out.println(doc.text()); 

出力は次のとおりです。

Google Ricerca Immagini Video Mappe News Shopping Gmail Altro » iGoogle | Cronologia web | Impostazioni | Accedi Italia   Ricerca avanzataStrumenti per le lingue PubblicitàSoluzioni AziendaliTutto su GoogleGoogle.com in English © 2012 - Privacy e Termini 

私の好きな私のページを開いてみてください場合:

http://www.mysite.com/test.php?link=http://www.myothersite.com/test/test1-/10968/try.html?params=65%253A12%257C66%253A2%257C39%253A6%257C72%253A5104&rt=nc&_dmd=1&id=p3286.c0.m14&_vc=1&x=11&param1=p and d&sotto_categoria=_ 

と私を得ますIOException

java.io.IOException: 400 error loading URL http://www.mysite.com/test.php?link=http://www.myothersite.com/test/test1-/10968/try.html?params=65%253A12%257C66%253A2%257C39%253A6%257C72%253A5104&rt=nc&_dmd=1&id=p3286.c0.m14&_vc=1&x=11&param1=p and d&sotto_categoria=_ 
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:362) 
    at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:338) 
    at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:136) 
    at org.jsoup.helper.HttpConnection.get(HttpConnection.java:125) 

何が問題なのですか?誰か助けてくれますか?ありがとう!

答えて

2

私は がちょうど-に置き換えるのqueryStringに黒いスペースを削除...非常に簡単な方法で解決:)

+0

buddy.Youが私の一日保存感謝を。 – NamingException

関連する問題