|
yahooオークションの自動ログインシステムをプログラムしていますが、ログインできません。 どなたかご教授願います。以下にソースを掲載しておきます。 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("Cookie","B=banotfp0orfbj&b=2"); con.setRequestProperty("Accept-Language", "ja"); con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"); // 出力ストリームを取得 PrintWriter out = new PrintWriter(con.getOutputStream()); out.print(".tries=1"); out.print(".done=http://page7.auctions.yahoo.co.jp/jp/auction/g25311966?"); out.print(".src=auc"); out.print("lg=jp"); out.print(".intl=jp"); out.print("login=********"); out.print("passwd=*******"); 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(); } } } post.htmlにはログインされた後の商品ページが表示されます(ログインできれば) |
|
yahooオークションの自動ログインプログラムを開発していますが、どーしてもログイン できません。どなたかご教授願います。以下にソースを掲載します。 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("Cookie","B=banotfp0orfbj&b=2"); con.setRequestProperty("Accept-Language", "ja"); con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"); // 出力ストリームを取得 PrintWriter out = new PrintWriter(con.getOutputStream()); out.print(".tries=1"); out.print(".done=http://page7.auctions.yahoo.co.jp/jp/auction/g25311966?"); out.print(".src=auc"); out.print("lg=jp"); out.print(".intl=jp"); out.print("login=******"); out.print("passwd=*****"); 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(); } } } なお、post.htmlには正常にログインできれば商品ページのソースを書き込みます。 |
|
はじめまして、こんばんは. http://x68000.q-e-d.net/~68user/net/c-http-1.html や http://x68000.q-e-d.net/~68user/net/c-http-2.html 関連で、 URL の解釈について、 http://www-cms.phys.s.u-tokyo.ac.jp/~naoki/CIPINTRO/CCGI/pbrowser.html のような記事を見つけました. 正規表現でも見かけられるやりかたでできるのだなぁと目が覚めました. 質問でもなんでもないのですが、お邪魔しましたm(_ _)m |
|
>>4040 やまさん Java の実行環境がないので検証できませんが、普通にブラウザでアクセスし、 ethereal などでパケットダンプしましょう。さらに自作プログラムのやりとりも 同様にパケットダンプして見比べてみましょう。 >>4041 waka http://www.din.or.jp/~ohzaki/perl.htm#httpURL というのもあります。 scanf 系で %[..] として文字集合が使えるのは初めて知りました。 |
|
FTPクライアントで分割ダウンロードする場合、 どんなプログラムになるのでしょうか? HTTPクライアントで分割アップロードする場合、 どんなプログラムになるのでしょうか? 教えて頂けませんか? |
|
>>4043 クライアント > FTPクライアントで分割ダウンロードする場合、 > どんなプログラムになるのでしょうか? REST を使います。 > HTTPクライアントで分割アップロードする場合、 > どんなプログラムになるのでしょうか? 分割アップロードが PUT を指すのか POST を指すのか知りませんが、 規格としては分割アップロードなるものは規定されていないと思います。 サーバ側の CGI なり Servlet なりで引数を解釈するようなつくりに すれば、なんだって可能です。 |