use strict;
use LWP;
use URI::Escape;
use HTTP::Request::Common;
use constant RFC_SEARCH => 'http://10.3.1.107/test.php';
use constant RFC_REFERER => 'http://10.3.1.107/test.php';
my $ua = LWP::UserAgent->new;
my $search_terms = "@ARGV";
my $request = POST ( RFC_SEARCH,
Content => [ username => $search_terms ],
Referer => RFC_REFERER
);
my $response = $ua->request($request);
die $response->message unless $response->is_success;
my $content = $response->content;
print $content;
我运行 test.pl ddd
问题是,打印出来的$content之后,既不是Right,也不是Wrong,而是HTML源代码。请问什么原因???
十分感谢~~作者: ulmer 时间: 2007-02-01 16:36 标题: 回复 1楼 lvlfforever 的帖子 simplest way to set your php script httpd header as "content-type: text/plain"
after $_POST['submit'] was checked.
for eaxample:
<?php
if ($_POST['submit']) {
header("content-type: text/plain");
....
}
?>
PHP as default outputs usually "content-type: text/html" with some html z´tag.