68user's page 掲示板

Prev< No. 4045> Next  [最新発言に戻る] [過去ログ一覧]
No. 4045 # やまさん [E-mail] 2004/11/09 (火) 20:34:29
68userさんご教授ありがとうございます。言われたとおりにパケットダンプしてソースを
書き直したところ、今度はcookieが無効であると言う画面がでました。
書き直したソースは以下の通りです。
import java.net.*;
import java.io.*;

public class post {
    public static void main(String[] args) {
        try {
            int start = 0;
            PrintWriter pw = new PrintWriter
                        (new BufferedWriter(new FileWriter("post.html")));

            // URLクラスのインスタンスを生成
            URL helloURL =
                        new URL("http://login.yahoo.co.jp/config/login");

            // 接続します
            URLConnection con = helloURL.openConnection();
            // 出力を行うように設定します


            con.setDoOutput(true);
            con.setDoInput(true);

            con.setRequestProperty("Accept","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*");
            con.setRequestProperty("Accept-Language", "ja");
            con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            con.setRequestProperty("Accept-Encoding", "gzip, deflate");
            con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)");
            con.setRequestProperty("Host","login.yahoo.co.jp");
            con.setRequestProperty("Content-Length","145");
            con.setRequestProperty("Connection","Keep-Alive");
            con.setRequestProperty("Cache-Control","no-cache");






            // 出力ストリームを取得
            PrintWriter out = new PrintWriter(con.getOutputStream());

            out.print(".tries=1&.done=http%3A%2F%2Fpage7.auctions.yahoo.co.jp%2Fjp%2Fauction%2Fg25311966%3F&.src=auc&lg=jp&.intl=jp&login=formulaatsushi&passwd=formula3");

            out.close();



            // 入力ストリームを取得
            BufferedReader in = new BufferedReader(
                                                                new InputStreamReader(
                                                                con.getInputStream(),"JISAutoDetect"));

            // 一行ずつ読み込みます
            String line;
            while ((line = in.readLine()) != null) {
                // 表示します
                pw.println(line);


            }


            // 入力ストリームを閉じます
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
etherealのログ
POST /config/login HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
Accept-Language: ja
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Host: login.yahoo.co.jp
Content-Length: 145
Connection: Keep-Alive
Cache-Control: no-cache

HTTP/1.1 302 Found
Date: Tue, 09 Nov 2004 10:41:26 GMT
P3P: policyref="http://privacy.yahoo.co.jp/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Location: http://login.yahoo.co.jp/config/verify?.done=http%3a//page7.auctions.yahoo.co.jp/jp/auction/g25311966%3f&.src=auc
Cache-Control: private
Pragma: no-cache
Expires: Thu, 05 Jan 1995 22:00:00 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=euc-jp
Set-Cookie: B=0jed4t90p17mm&b=2; expires=Thu, 15 Apr 2010 20:00:00 GMT; path=/; domain=.yahoo.co.jp
Set-Cookie: F=a=2AxMxi8sve2gE8jFN9rJ0gWrAAvZQREqLtzb2_UZvSzjM5JqtaIqse_xaCta&b=pEuj; expires=Thu, 15 Apr 2010 20:00:00 GMT; path=/; domain=.yahoo.co.jp
Set-Cookie: Y=v=1&n=2q7rnefmn4krh&l=5ehckb00jiki78/o&p=m2avvjp403000400&r=bk&lg=jp&intl=jp&np=1; path=/; domain=.yahoo.co.jp
Set-Cookie: T=z=W7JkBBWBfkBBIROI05ItUNi&a=YAE&sk=DAA.hvzZ6s/ztd&d=YQFZQUUBb2sBWlcwLQF0aXABYm4ySnNEAXp6AVc3SmtCQmdXQQ--; path=/; domain=.yahoo.co.jp

GET /config/verify?.done=http%3a//page7.auctions.yahoo.co.jp/jp/auction/g25311966%3f&.src=auc HTTP/1.1
User-Agent: Java1.4.0
Host: login.yahoo.co.jp
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

HTTP/1.1 200 OK
Date: Tue, 09 Nov 2004 10:41:26 GMT
P3P: policyref="http://privacy.yahoo.co.jp/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Refresh: 900; URL=http://www.yahoo.co.jp/
Cache-Control: private
Pragma: no-cache
Expires: Thu, 05 Jan 1995 22:00:00 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=euc-jp
Set-Cookie: B=c0ev5h10p17mm&b=2; expires=Thu, 15 Apr 2010 20:00:00 GMT; path=/; domain=.yahoo.co.jp


/config/verify?.done=http%3a//page7.auctions.yahoo.co.jp/jp/auction/g25311を
getする際にヘッダー情報が変わってしまいます。
どなたかご教授願います。

Prev< No. 4045> Next  [最新発言に戻る] [過去ログ一覧]