I am trying to post some data to a web site to avoid filling out some forms
on a given web site every time with a web browser. Unfortunately it is not
working in the right manner. I've two problems:

I am sending the following file 
1.txt:
"POST /login.php HTTP/1.1
Accept: image/gif[...]
....
Content-Length: 127
Connection: Keep-Alive
Cache-Control: no-cache

LoginName=xxxxx&FomData=Request_new_Data&.....
"
with this script:

use Socket;
 my $proto = getprotobyname('tcp');
 socket(F, 'www.xy.z', SOCK_STREAM, $proto);
 my $sin = sockaddr_in(80,inet_aton('www.xy.z'));
 connect(F,$sin) || return undef;
 my $old_fh = select(F);
 $| = 1; 
 select($old_fh);

 $fn = "1.txt";      # input File
 open fn or die "Can't find File $fn: $!\n";
 while (<fn>) {
  print F $_;
 }
 close fn;  # this should send the header and the post data

  while (<F>) {        #print the received header and body
    print fn_out "$_";
  }
#  now I'd like to process the received header and data, change 1.txt and do
it again:
 $fn = "1.txt";      # input File
 open fn or die "Can't find File $fn: $!\n";
 while (<fn>) {
  print F $_;
 }
 close fn;  # this should send the header and the post data

  while (<F>) {        #should print the received header and body, but
unfortunately does not work
    print fn_out "$_";
  }

Now my first problem is that my request is split up into two ip packets:

First packet contains 'POST /login.php HTTP/1.1'
Second packet contains 'Accept: image.....'
I don't know if this is a problem but as it does not work (I do not get the
same response as I did with the web browser) it seems to me that is (the
browser sent only one packet).

My second problem is that the second request does not work at all. It seems
to me that the while (<F>) is waiting till the connection is closed and then
the second request is not sent.

Please help me.

John Burba 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to