Показать сообщение отдельно
Старый 18.01.2006, 15:33     # 1
PoTat
Guest
 
Сообщения: n/a

HTTP заголовки

есть гостевая http://www.qxserenity.com/AdvancedGu...k/addentry.php
хочу написать скрипт который будет автоматически в нее мессаги добавлять..
При заполнении этой книги HTTP снифир выдает следующее:
http://www.qxserenity.com/AdvancedGu...k/addentry.php

POST /AdvancedGuestBook/addentry.php HTTP/1.1
Host: www.qxserenity.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8) Gecko/20051111 Firefox/1.5
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,ru-ru;q=0.7,ru;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: http://www.qxserenity.com/AdvancedGu...k/addentry.php
Content-Type: multipart/form-data; boundary=---------------------------41184676334
Content-Length: 1138
-----------------------------41184676334
Content-Disposition: form-data; name="gb_name"

Linda
-----------------------------41184676334
Content-Disposition: form-data; name="gb_email"

sova@wer.biz
-----------------------------41184676334
Content-Disposition: form-data; name="gb_location"

http://scrp.alfaspace.net
-----------------------------41184676334
Content-Disposition: form-data; name="gb_url"

http://headway.alfamoon.com
-----------------------------41184676334
Content-Disposition: form-data; name="gb_icq"

436734
-----------------------------41184676334
Content-Disposition: form-data; name="gb_aim"


-----------------------------41184676334
Content-Disposition: form-data; name="gb_gender"

m
-----------------------------41184676334
Content-Disposition: form-data; name="userfile"; filename=""
Content-Type: application/octet-stream


-----------------------------41184676334
Content-Disposition: form-data; name="gb_comment"

Good work
-----------------------------41184676334
Content-Disposition: form-data; name="gb_action"

Submit
-----------------------------41184676334--
ну а вот и мой скрипт...
#################################################
#! /usr/bin/perl -w

use LWP::UserAgent;
open (FILE, "file.txt");
@wer=<FILE>;

$wer=<STDIN>;
@rew=splice (@wer, 0, $wer);
$ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7");
$ua->proxy('http',"http://proxy.wplus.net:3128");

for ($i=0; $i<@rew; $i++) {
my $req = HTTP::Request->new(POST => "$rew[$i]");
$req->header('Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5');
# $ref=$rew[$i];
$req->header('referer' => "http://www.qxserenity.com/AdvancedGuestBook/addentry.php");
$req->header ('Accept-Charset' => 'windows-1251,utf-8;q=0.7,*;q=0.7');
$req->header ('Accept-Language' =>'en-us,ru-ru;q=0.7,ru;q=0.3');
$req->header ('Encoding'=> 'gzip,deflate');


$req->content("boundary=41184676334&gb_name=Ivan&gb_email=cobra@yandex.biz& gb_location=http://test.ru&gb_url=http://test2.ru&gb_icq=536356&gb_aim=2362456&gb_gender=m&userfile=&filename=& gb_comment=Privetgb_action=Submit");



my $res = $ua->request($req);

# print $res->as_string;

}

Последний раз редактировалось PoTat; 18.01.2006 в 15:39.