#!/usr/local/bin/perl # POSTデータを読み込む read(STDIN, $post, $ENV{'CONTENT_LENGTH'}); # ユーザエージェントオブジェクトを生成する use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent($ENV{HTTP_USER_AGENT}); # リクエストを生成する my $req = new HTTP::Request POST => 'http://pc.2ch.net/test/bbs.cgi';#自分のURLに書き換えてください $req->header(Cookie => "NAME=name"); $req->header(Referer => "http://pc.2ch.net/perl/"); $req->header(Via => "ThroughTheLookingGlass " . $ENV{REMOTE_ADDR}); $req->content_type('application/x-www-form-urlencoded'); $req->content($post); # リクエストをユーザエージェントに渡し、レスポンスを受け取る my $res = $ua->request($req); # レスポンスの内容を確認する print "Content-type: text/html\n\n"; if ($res->is_success) { print $res->content; }