0

当我使用直接参数和通过数据对象时,我得到了 2 个不同的结果


测试1:直接连接

String url = "https://wl-prod.sabresonicweb.com/SSW2010/B3QE/webqtrip.html?searchType=NORMAL&lang=en&journeySpan=OW&origin=NGO&destination=SGN&numAdults=1&numChildren=0&numInfants=0&promoCode=&alternativeLandingPage=true&departureDate=2013-12-27";

            Document doc = Jsoup
                    .connect(url)                    
                    .userAgent("Mozilla")
                    .get();
            Element tableE = doc.getElementById("dtcontainer-both");
            System.out.println(tableE.html());

--> 注意最后一行:货币是日元


测试 2:使用数据对象

String url = "https://wl-prod.sabresonicweb.com/SSW2010/VNVN/webqtrip.html";
            Map<String, String> data = new HashMap<String, String>();
            data.put("searchType", "NORMAL");
            data.put("lang", "en");            
            data.put("journeySpan", "OW");
            data.put("origin", "NGO");
            data.put("destination", "SGN");
            data.put("numAdults", "1");
            data.put("numChildren", "0");
            data.put("numInfants", "0");
            data.put("promoCode", "");
            data.put("alternativeLandingPage", "true");
            data.put("departureDate", "2013-12-27");

            Document doc = Jsoup
                    .connect(url)
                    .data(data)                                        
                    .userAgent("Mozilla")
                    .get();
            Element tableE = doc.getElementById("dtcontainer-both");
            System.out.println(tableE.html());

--> 注意最后一行:货币是 VND

谁能告诉我我错在哪里?

4

2 回答 2

0

我认为您的网址不同:

1) "https://wl-prod.sabresonicweb.com/SSW2010/B3QE/webqtrip.html"
2) "https://wl-prod.sabresonicweb.com/SSW2010/VNVN/webqtrip.html"

注意:B3QE != VNVN

我没有对此进行测试,因此您可能还会受到其他干扰...

于 2013-09-23T07:53:05.287 回答
0

看起来您的两个 URL 路径不同:一个包含 B3QE,另一个包含 VNVN。

于 2013-09-23T07:55:02.517 回答