0

I want to check Hong Kong IFC mall store's iPhone4s stock state.

So, I need to go Choose products to detect the stock state "choose product link". But before I go to the Choose product pages, it necessary to choose store in previous page. if I didn't choose the store, and direct go to choose product page, it will display "Your session timed out."

How do I programmatically choose IFC mall in Apple store reserve and go to next pages by jsoup?

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
user767528
  • 13
  • 3

1 Answers1

1

it will display "Your session timed out."

The session is backed by cookies. You need to maintain the session by sending the retrieved response cookies back on subsequent requests.

// #1.
Connection connection1 = Jsoup.connect("http://example.com/firstpage");
Response response1 = connection1.execute();
Map<String, String> cookies = response1.cookies();
Document document1 = response1.parse(); // If necessary.
// ...

// #2.
Connection connection2 = Jsoup.connect("http://example.com/nextpage").cookies(cookies).data("param1", "value1");
Response response2 = connection2.execute();
cookies.putAll(response2.cookies());
Document document2 = response2.parse();
// ...

// Repeat #2.
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555