sessionとcookieの2つはホームページの閲覧の中で比較的よくみかける概念です。これらはまた区別するのが難しい概念でもあります。しかし認証の必要なサービスやページの統計では相当重要になってきます。まずsessionとcookieがいったいどういうものか理解していくことにしましょう。このような問題を考えます: どのようにしてアクセスに制限のあるページをスクレイピングすればよいでしょうか?例えば新浪マイクロブログの友達のメインページや個人のマイクロブログのページ等です。 当然ブラウザから手動でユーザ名とパスワードを入力し、ページにアクセスすることができます。いわゆる"スクレイピング"とはプログラムを使って同じような作業を行うことを言います。そのため、"ログイン"の過程で何が発生しているのか理解する必要があります。 ユーザがマイクロブログのログイン画面にきた時、ユーザ名とパスワードを入力