Sponsored Content
Top Forums Shell Programming and Scripting checking the request for urls - perl Post 302342454 by KiD0 on Sunday 9th of August 2009 10:02:33 PM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
URLS.TXT(5)							File Formats Manual						       URLS.TXT(5)

NAME
urls.txt - URL database for regression testing INTRODUCTION
The urls.txt file is installed by default in /etc/siege/urls.txt. When siege is invoked without a command line reference to a URL, then by default it looks for urls in that file. The advantage of using the urls.txt file is two-fold: One, it frees you free retyping a url with every invocation. And two, it allows you to conduct full site regression testing. When the urls.txt file is used, siege reads all the urls in that file into memory and runs through the list in one of two ways, sequen- tially or randomly. The default run is sequential from start to finish and back again until the --reps or the --time option has been satis- fied. With the -i/--internet option selected, siege runs through the file randomly simulating the stress applied by a community of inter- net users. The -f/--file option allows you to select a file other then the default urls.txt file. You may also instruct siege to use a different file with the "file" directive in .siegerc, i.e., "file = /usr/local/etc/urls.txt" You may set and reference variables inside the urls.txt file. All variables must be declared BEFORE they are referenced. Variables are declared with the "=" operator, VARIABLE = VALUE. They are then referenced inside $() or ${}, example: $(HOST), ${HOST} HOST=joey.joedog.org http://${HOST}/browse.jsp?size=5 http://${HOST}/admin.jsp?name=ralph EXAMPLE FILE
This is an exmple urls.txt file. Lines beginning with a hash (#) are comments and ignored by siege. # # Example urls.txt file # URLs database for siege # http://www.haha.com/index.html http://www.haha.com/howto/index.html http://www.haha.com/cgi-bin/howto/display.cgi?1013 www.haha.com/cgi-bin/fm.cgi?first=j.&last=fulmer https://www.haha.com/index.shtml https://www.whoohoo.com/my_whoohoo.jsp # POST data requires a POST directive www.haha.com/cgi-bin/foo.cgi POST first=bart&last=simpson www.haha.com/hoho.jsp POST name=jeff&pass=secret # POST the contents of a file using the # line input character "<" http://www.haha.com/my.jsp POST </home/jeff/data.txt AUTHOR
Jeffrey Fulmer <jeff@joedog.org>, et al. BUGS
Report bugs to jeff@joedog.org. Give a detailed description of the problem and report the version of siege that you are using. COPYRIGHT
Copyright (C) 2007 Jeffrey Fulmer, et al. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. AVAILABILITY
The most recent released version of siege is available by anonymous FTP from ftp.joedog.org in the directory pub/siege. SEE ALSO
siege(1) siege.config(1) layingsiege(7) Siege v2.70 April-17-2012 URLS.TXT(5)
All times are GMT -4. The time now is 12:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy