[Gllug] Perl script to POST data and the GET returned info

David Zverina david at zverina.co.uk
Thu May 15 21:47:05 UTC 2003


Another alternative (quick and dirty hack) is to use "lynx --post_data".

The advantage is that it can also format the html into readable text
which can be easier to parse. However if you do not want this use the
--source switch.

Here's an example:
open FOO, ">data.txt";
print FOO "q=linux\n";
print FOO "---\n";
close FOO;

system "lynx -post_data
'http://newssearch.bbc.co.uk/cgi-bin/search/results.pl'
< data.txt >  foo.txt";

open FOO, "foo.txt";
while(<FOO>) {
        print $_;
}

Cheers,

Dave.

On Thu, 2003-05-15 at 19:35, will wrote:
> On Thu, 2003-05-15 at 19:18, Neil Fryer wrote:
> > Hi All,
> > 
> > Can anyone please point me to a script that can do the above on a webserver,
> > as I need this urgently.
> 
> Have a look at LWP::UserAgent.  You should be able to knock up a script
> in a few minutes to do what you want:
> 
> http://search.cpan.org/author/GAAS/libwww-perl-5.69/lib/LWP/UserAgent.pm
> 
> Also, have a look at the O'Reilly Perl and LWP book:
> 
> http://www.oreilly.com/catalog/perllwp/
> 
> Will.
> 
> 
> 
> -- 
> Gllug mailing list  -  Gllug at linux.co.uk
> http://list.ftech.net/mailman/listinfo/gllug




-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list