|
|
ru.cgi.perl- RU.CGI.PERL ------------------------------------------------------------------ From : Alexander Averbuh 2:4625/69.123 11 Oct 2001 18:43:00 To : Victor Lazarchuk Subject : Error 302 --------------------------------------------------------------------------------
і АДЩ ДБ
Hello, Victor! Как поживает твой hерц?
Четверг Октябрь 11 2001 00:08, Victor Lazarchuk wrote to All:
VL> use LWP::UserAgent;
VL> use HTTP::Request::Common;
VL> $ua = new LWP::UserAgent;
VL> $response = $ua->request(POST 'http://www.host.com/script.php3',
VL> [param1=>'1',param2=>'2',param3=>'3']);
VL> if ($response->is_success) {
VL> print $response->content;
VL> } else {
VL> print $response->error_as_HTML;
VL> }
Я делаю это вот так:
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
# Зфхёь чрфрхтёя URL ъ CGI-яЁшыюцхэшю, юсЁрсртытрющхьу чряЁюё
my $req = new HTTP::Request POST =>
'http://localhost/forum/cgi-bin/sendreg.pl';
$req->content_type('application/x-www-form-urlencoded');
$req->content('email=test@com.ua'); # чфхёь яхЁхфрхтёя ётЁюър
$req->ярЁрьхтЁют
# т ётрэфрЁтэюь фюЁьртх
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
Пример из perldoc, кстати.
С уважением, Alexander
Так, идите мыть руки, Victor!
E-mail, SMS: alexaver@svitonline.com http://alhome.virtualave.net
http://haverim.virtualave.net
> Если ты будешь бройгес, я тебе сделаю такой цурыс, что ты всю жизнь будешь
> иметь нахес, надевать тфилин и носить цицис!
--- GoldED 2.50+
* Origin: Горшок - это филиал унитаза. (2:4625/69.123)
Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.cgi.perl/39713bc5f6b6.html, оценка из 5, голосов 10
|