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());

--> 最後の行に注意してください: currency is JPY


テスト 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());

--> 最後の行に注意してください: currency is VND

誰が私が間違っているのか教えてもらえますか?

4

2 に答える 2

0

2 つの URL パスが異なっているようです。1 つは B3QE を含み、もう 1 つは VNVN を含みます。

于 2013-09-23T07:55:02.517 に答える
0

あなたのURLは違うと思います:

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 に答える