11-30-2006
Quote:
Originally Posted by cbkihong
Please rephrase your question, say with some illustration. I am not totally sure the exact question you have.
LWP is okay, but more complicated with its API. If you are just interested in simply access an HTTP URL and get the results, LWP::Simple is a simpler choice.
http://search.cpan.org/~gaas/libwww-.../LWP/Simple.pm
ok. i have a list of names (first and last name) that i need to automatically search for on a site called, for instance,
www.finestar.com.
on this site called finestar.com are search boxes where you can input the first name or last name of the person your looking for.
now, the list of names i have is quite enormous so manually searching for them on this site is virtually impossible or basically impractical.
enter perl
so i need to use perl to parse the list of names into the search boxes on the site called
www.finestar.com and pull out any reference to the names being searched for.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear all,
I am new to perl script and would need some help for my 1st script. I wrote a script to search sprintf(buf,"%s", sourcestring) and replace with snprintf(buf, sizeof(buf),"%s", sourcestring). As snprintf() requires an extra argument, so it is not a simple search-and-replace. I need to... (1 Reply)
Discussion started by: ChaMeN
1 Replies
2. Shell Programming and Scripting
Good evening All,
I have a perl script to pull out all occurrences of a files beginning with xx and ending in .p. I will then loop through all 1K files in a directory. I can grep for xx*.p files but it gives me the entire line. I wish to output to a single colum with only the hits found. ... (3 Replies)
Discussion started by: CammyD
3 Replies
3. Shell Programming and Scripting
Hello,
I have a script, but its sorta broke and I need help to tweak it
#!/usr/bin/perl
my @files_to_search = ("exportOBJ-sark.txt","ResourceRecText-ALL.txt","exportdnsrr-report.txt");
open (FL, "sark.com.txt");
my %search_hash = ();
while (my $line = <FL>) {
my @parts =... (12 Replies)
Discussion started by: richsark
12 Replies
4. Shell Programming and Scripting
hi,
i have one file as t1.txt as below
hi
hello
welcome
i want perl script to search for the pattern "abcd" in the file.
if the pattern doesn't exist, i want to insert that pattern at the end of the same file t1.txt
my o/p should be
hi
hllo
welcome
abcd
thank you (3 Replies)
Discussion started by: roopa
3 Replies
5. Shell Programming and Scripting
Hi All
Can anyone please help me how to open a webpage suppose(Google)
with the help of perl script and refresh it after every 5 minutes. (0 Replies)
Discussion started by: parthmittal2007
0 Replies
6. Shell Programming and Scripting
Hi All
Below is Code, It opens a link from which it ask a login name and password, the script enter the login name and password and navigate to next page..
In the next page there is a drop down box from which i have to select a value, I have written the code but it gives error
#!/usr/bin/perl... (3 Replies)
Discussion started by: parthmittal2007
3 Replies
7. Shell Programming and Scripting
I am requesting for the text parsing section below. Any helps are highly appreciated.
<tr valign="top"><td nowrap>Source name</td>
<td style="text-align: justify">Sample Name<br></td>
I want Sample Name from above.
In the same file, I have to search for another pattern like this
<td><a... (1 Reply)
Discussion started by: jacobs.smith
1 Replies
8. Shell Programming and Scripting
Hi Team,
I have a requirement to login into URL using username and password , then I have to select a "particular name" from drop-down menu and then Read the values user records etc.... using perl.
Is it possible to do in perl script ? (OR) Can you please let me know which scripting... (1 Reply)
Discussion started by: latika
1 Replies
9. Shell Programming and Scripting
foreach my $ds (sort {
$a->{books} cmp $b->{books} ||
(($a->{books} eq "A") ? ($a->{hammers} cmp $b->{hammers}) :
(($a->{shoes} <=> $b->{shoes}) ||
($a->{hammers}... (1 Reply)
Discussion started by: scj2012
1 Replies
10. Shell Programming and Scripting
hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who
i appreciated the help from last time when i was trying to script something, now i just have to try to... (2 Replies)
Discussion started by: ilovedoritos
2 Replies
LEARN ABOUT MOJAVE
lwp::simple5.18
LWP::Simple(3) User Contributed Perl Documentation LWP::Simple(3)
NAME
LWP::Simple - simple procedural interface to LWP
SYNOPSIS
perl -MLWP::Simple -e 'getprint "http://www.sn.no"'
use LWP::Simple;
$content = get("http://www.sn.no/");
die "Couldn't get it!" unless defined $content;
if (mirror("http://www.sn.no/", "foo") == RC_NOT_MODIFIED) {
...
}
if (is_success(getprint("http://www.sn.no/"))) {
...
}
DESCRIPTION
This module is meant for people who want a simplified view of the libwww-perl library. It should also be suitable for one-liners. If you
need more control or access to the header fields in the requests sent and responses received, then you should use the full object-oriented
interface provided by the "LWP::UserAgent" module.
The following functions are provided (and exported) by this module:
get($url)
The get() function will fetch the document identified by the given URL and return it. It returns "undef" if it fails. The $url
argument can be either a string or a reference to a URI object.
You will not be able to examine the response code or response headers (like 'Content-Type') when you are accessing the web using this
function. If you need that information you should use the full OO interface (see LWP::UserAgent).
head($url)
Get document headers. Returns the following 5 values if successful: ($content_type, $document_length, $modified_time, $expires, $server)
Returns an empty list if it fails. In scalar context returns TRUE if successful.
getprint($url)
Get and print a document identified by a URL. The document is printed to the selected default filehandle for output (normally STDOUT) as
data is received from the network. If the request fails, then the status code and message are printed on STDERR. The return value is
the HTTP response code.
getstore($url, $file)
Gets a document identified by a URL and stores it in the file. The return value is the HTTP response code.
mirror($url, $file)
Get and store a document identified by a URL, using If-modified-since, and checking the Content-Length. Returns the HTTP response code.
This module also exports the HTTP::Status constants and procedures. You can use them when you check the response code from getprint(),
getstore() or mirror(). The constants are:
RC_CONTINUE
RC_SWITCHING_PROTOCOLS
RC_OK
RC_CREATED
RC_ACCEPTED
RC_NON_AUTHORITATIVE_INFORMATION
RC_NO_CONTENT
RC_RESET_CONTENT
RC_PARTIAL_CONTENT
RC_MULTIPLE_CHOICES
RC_MOVED_PERMANENTLY
RC_MOVED_TEMPORARILY
RC_SEE_OTHER
RC_NOT_MODIFIED
RC_USE_PROXY
RC_BAD_REQUEST
RC_UNAUTHORIZED
RC_PAYMENT_REQUIRED
RC_FORBIDDEN
RC_NOT_FOUND
RC_METHOD_NOT_ALLOWED
RC_NOT_ACCEPTABLE
RC_PROXY_AUTHENTICATION_REQUIRED
RC_REQUEST_TIMEOUT
RC_CONFLICT
RC_GONE
RC_LENGTH_REQUIRED
RC_PRECONDITION_FAILED
RC_REQUEST_ENTITY_TOO_LARGE
RC_REQUEST_URI_TOO_LARGE
RC_UNSUPPORTED_MEDIA_TYPE
RC_INTERNAL_SERVER_ERROR
RC_NOT_IMPLEMENTED
RC_BAD_GATEWAY
RC_SERVICE_UNAVAILABLE
RC_GATEWAY_TIMEOUT
RC_HTTP_VERSION_NOT_SUPPORTED
The HTTP::Status classification functions are:
is_success($rc)
True if response code indicated a successful request.
is_error($rc)
True if response code indicated that an error occurred.
The module will also export the LWP::UserAgent object as $ua if you ask for it explicitly.
The user agent created by this module will identify itself as "LWP::Simple/#.##" and will initialize its proxy defaults from the
environment (by calling $ua->env_proxy).
CAVEAT
Note that if you are using both LWP::Simple and the very popular CGI.pm module, you may be importing a "head" function from each module,
producing a warning like "Prototype mismatch: sub main::head ($) vs none". Get around this problem by just not importing LWP::Simple's
"head" function, like so:
use LWP::Simple qw(!head);
use CGI qw(:standard); # then only CGI.pm defines a head()
Then if you do need LWP::Simple's "head" function, you can just call it as "LWP::Simple::head($url)".
SEE ALSO
LWP, lwpcook, LWP::UserAgent, HTTP::Status, lwp-request, lwp-mirror
perl v5.18.2 2012-02-18 LWP::Simple(3)