N
nonews.org
Hi. I need put a long text via POST protocol. My souce code:
#!/usr/bin/perl
use HTTP::Request::Common;
use LWP::UserAgent;
$textfile = "testo.txt";
open(TXT, "<$textfile") || die ("Impossibile aprire $textfile");
$size = (stat(TXT))[7];
read(TXT,$TEXT,$size);
$ua = LWP::UserAgent->new;
$ua->request(
POST 'http://127.0.0.1/gandu/tmp/get.php',
Content_Type => 'form-data',
Content_Size => $size,
# Content => [ q => "qqq" ]
Content => [ q => "$TEXT" ]
);
close TXT;
Now, if I decomment "Content => [ q => "qqq" ]" it works, but if I put
$TEXT (or long string) script failed. Can you help me?
#!/usr/bin/perl
use HTTP::Request::Common;
use LWP::UserAgent;
$textfile = "testo.txt";
open(TXT, "<$textfile") || die ("Impossibile aprire $textfile");
$size = (stat(TXT))[7];
read(TXT,$TEXT,$size);
$ua = LWP::UserAgent->new;
$ua->request(
POST 'http://127.0.0.1/gandu/tmp/get.php',
Content_Type => 'form-data',
Content_Size => $size,
# Content => [ q => "qqq" ]
Content => [ q => "$TEXT" ]
);
close TXT;
Now, if I decomment "Content => [ q => "qqq" ]" it works, but if I put
$TEXT (or long string) script failed. Can you help me?