Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have been trying to read some data from a web using LWP::UserAgent and this is what i have tried so far.
when i print using dumper (as per suggestions in CB)i am able to print the content but when itry to open using file handler it gives me an error as nosuch file or directory Can you please advise on how do i process on each line of $request. when i print $request using dumper it prints HTML format as below and i need to extract only the names can i have regex also please.use Data::Dumper; require LWP::UserAgent; require HTTP::Request; my $request = HTTP::Request->new(GET => 'http://pilot/sanju/index.php/ +empdata'); my $ua = LWP::UserAgent->new; my $response = $ua->request($request); unless($response->is_success) { die 'Cannot connect to remote address' +; } my $cmd = $response->content; # print Dumper \$response; open (FILE, "<" , \$cmd ) or die $! ; while (<FILE>){ chomp; print $_; }
<td> 1 </td><td>engg </td><td> staff </td><td> ruslion,marry</td></ +tr> <tr> <td> 2 </td><td>accounts </td><td> operational </td><td> tom, +harry </td></tr> <tr><td> 3 </td><td>HR </td><td> support </td><td> john, +wirth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help on getting data from LWP::UserAgent
by pc88mxer (Vicar) on Jun 16, 2008 at 04:47 UTC | |
by Anonymous Monk on Jun 16, 2008 at 06:50 UTC | |
|
Re: Help on getting data from LWP::UserAgent
by CountZero (Bishop) on Jun 16, 2008 at 05:21 UTC | |
by Anonymous Monk on Jun 16, 2008 at 05:26 UTC | |
by ikegami (Patriarch) on Jun 16, 2008 at 06:55 UTC |