checking the request for urls - perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting checking the request for urls - perl
# 1  
Old 08-09-2009
checking the request for urls - perl

hi everybody .



i'm trying to extract a bunch of urls from an http request but when i do that i get nothing .

here it's my code

Code:
 use LWP::UserAgent; 
$url = "$ARGV[0]"; $ua = LWP::UserAgent->new; 
$req = HTTP::Request->new(GET=>$url); 
$res = $ua->request($req); 
if ($res->is_success) {  
 
   
 
@a = $res->decoded_content;  
 
@u = grep /COM/, @a;  
 
print @u;  
 
}

and i also treid this
Code:
use LWP::UserAgent;
 $url = "$ARGV[0]";
 $ua = LWP::UserAgent->new;
 $req = HTTP::Request->new(GET=>$url);
 $res = $ua->request($req);
 if ($res->decoded_content =~ /COM/) { 
 
 print $res->decoded_content =~ /COM/ 
 
 }

usage: perl $0 The UNIX and Linux Forums - Learn UNIX and Linux from Experts and both of them didn't give any urls . and i also read about HTTP:Smiliearser and i couldn't understand it
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking the user input in perl for characters and length

My question is basically as the title says. How can I check a user inputted string is only certain characters long (for example, 3 characters long) and how do I check a user inputted string only contains certain characters (for example, it should only contain the characters 'u', 'a', 'g', and 'c')... (4 Replies)
Discussion started by: Eric1
4 Replies

2. Shell Programming and Scripting

Perl code request

Hi Perl Experts, I am new to Perl programming. can somebody please help me in writing Perl code for following "find and replace logic". i wanted to find following line in list of files in a given directory. ================================================ for(i=0;i <... (2 Replies)
Discussion started by: chettyravi
2 Replies

3. Shell Programming and Scripting

Shell or Perl Loop Screenshot URLs

I am trying to capture screenshots from a huge list of URLs. I am able to manually capture images of individual pages; that is, I simply run the following command to get a screenshot of Foo.com $ python /path/to/screencapture.sh http://www.foo.com I want to modify the script so that instead of... (2 Replies)
Discussion started by: chipperuga
2 Replies

4. Shell Programming and Scripting

checking co-presence of Var. - Shell or Perl

Hey fellas, I've posted this problem a few days back and I received just one post which was in PHP that I have no idea about! (Thanks to DGPickett) It would be so nice if you can help me with this in Shell or Perl. Here is the story: I have a big table with variables and observations. I... (9 Replies)
Discussion started by: @man
9 Replies

5. Shell Programming and Scripting

Need Suggestions to improve Perl script for checking malformed braces/brackets

Hi all, I've written a Perl script below that check and report for malformed braces. I have a UNIX ksh version and it took a couple of minutes to run on a 10000+ lines. With the Perl version it only took about 20 seconds so that is enough incentive for me to go Perl not to mention that I need... (1 Reply)
Discussion started by: newbie_01
1 Replies

6. UNIX for Dummies Questions & Answers

perl scripting for checking if a process is running

Hi All, I am new to perl and have been trying to write a short script to check a process.Though i havent reached to the stage where i can match the output. I am trying to pass a variable x with value /opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar and then pass another variable... (2 Replies)
Discussion started by: pistachio
2 Replies

7. Shell Programming and Scripting

Perl error checking question

I am not very good with perl but trying to force myself to start learning... I have a script that calls three other scripts in variables. I want to use a if statement to check the exit status and not sure how to do it.. This is basically what I have, the individual scripts print either a Y or... (1 Reply)
Discussion started by: i9300
1 Replies

8. Shell Programming and Scripting

Opening Files and checking contents in Perl

Hi All, I need some expert help in performing the following in Perl. I have a code below but it doesn;t seem to work. Can any expert give me some advice? Below are the requirements 1) Open numerous files assigned to an array @FILES. Note that the files are always named with the term... (7 Replies)
Discussion started by: Raynon
7 Replies

9. Shell Programming and Scripting

Perl data type checking

I am using perl 5.8.0. I need to check some values to see it they are floats. Our system does not have Data::Types so I can't use is_float. Is there something else that I can use? The only thing in Data is Dump.pm. I am not allowed to download anything to our system so I have to use what I have.... (3 Replies)
Discussion started by: ajgwin
3 Replies
Login or Register to Ask a Question