473,804 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cron perl script to navigate and down load a xls file

1 New Member
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use LWP;
  4. my $ua = new LWP::UserAgent;
  5.  
  6. $ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8)");
  7.  
  8.  
  9.  
  10. my $request = new HTTP::Request("GET", "http://www.ptcrb.com/File/dcCom/components/dcFileManagerV3/actions/act_downloadNonDirect.cfm/filename/gry_al_11212007.xls");
  11.  
  12. my $response = $ua->request($request);
  13.  
  14. if ($response->is_success) {
  15.         print $response->content;
  16. }
  17. else
  18. {
  19.         print $response->status_line, "\n";
  20. }
  21.  
  22.  
  23. ==========================
  24.  
  25.  
  26. ##!/usr/bin/perl -w
  27. #use strict;
  28. use warnings;
  29.  
  30. #cpan module
  31.  use WWW::Mechanize;
  32.  my $mech = WWW::Mechanize->new();
  33.  
  34.  #login
  35.  my $url='http://www.ptcrb.com';
  36.  $mech->get( $url );
  37.  print $mech->status();
  38.  
  39.  $mech->form_name('login');
  40.  $mech->set_visible('username','passw') ;
  41.  $mech->click('btnLogin');
  42.  print $mech->status().'login';
  43.  $mech->click('/File/Example.cfm');
  44.  print $mech->status().'clicked';
  45.  
==========
pl help me
Dec 4 '07 #1
1 1827
numberwhun
3,509 Recognized Expert Moderator Specialist
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use LWP;
  4. my $ua = new LWP::UserAgent;
  5.  
  6. $ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8)");
  7.  
  8.  
  9.  
  10. my $request = new HTTP::Request("GET", "http://www.ptcrb.com/File/dcCom/components/dcFileManagerV3/actions/act_downloadNonDirect.cfm/filename/gry_al_11212007.xls");
  11.  
  12. my $response = $ua->request($request);
  13.  
  14. if ($response->is_success) {
  15.         print $response->content;
  16. }
  17. else
  18. {
  19.         print $response->status_line, "\n";
  20. }
  21.  
  22.  
  23. ==========================
  24.  
  25.  
  26. ##!/usr/bin/perl -w
  27. #use strict;
  28. use warnings;
  29.  
  30. #cpan module
  31.  use WWW::Mechanize;
  32.  my $mech = WWW::Mechanize->new();
  33.  
  34.  #login
  35.  my $url='http://www.ptcrb.com';
  36.  $mech->get( $url );
  37.  print $mech->status();
  38.  
  39.  $mech->form_name('login');
  40.  $mech->set_visible('username','passw') ;
  41.  $mech->click('btnLogin');
  42.  print $mech->status().'login';
  43.  $mech->click('/File/Example.cfm');
  44.  print $mech->status().'clicked';
  45.  
==========
pl help me
This does nothing to get you any assistance. You posted code, but no explanation as to what your issue is, no error messages, nothing.

If you want help, then you are going to have to provide as much information as you possibly can. Just posting your code and saying "pl help me" doesn't tell us what is wrong.

Also, "pl" can be expanded to the proper word, PLEASE. This is not SMS text messaging and we are not limited to 160 characters.

Regards,

Jeff
Dec 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3197
by: JS | last post by:
I go to a website once a week to download public data. Upon submitting a form, a text file is producted and I get the usual Windows dialog box asking if I would like to open or save the text file locally. I save it locally. I am thinking about setting up a php script on an Apache server I use to host some websites. Basically, I would like the script (which is nothing more than a pre-populated form) to run as a cron job, get the text...
0
9750
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile. I need it to be compiled with threads. Anyone have any wisdom on how best to do this? Here's a transcript of my latest attempt. It's long; you might want to skip to the bottom, where I try "make" and the fatal errors start happening.
21
34447
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
3
1854
by: davidiwharper | last post by:
Hello everyone, I am running a database maintenance script to remove old entries from a log file. The script runs as expected when initiated manually: ./maintain.pl $HOME/website/database/ $HOME/logs/
5
3549
by: jcor | last post by:
Hi, I'm trying to run my first cron job, probably it's missing something. I created a perl script just to test, it's called "teste" !/usr/bin/perl open(DATA,">>/home/joao/files/output"); @Now = localtime(time); print DATA "@Now\n"; exit ;
3
2349
by: uzzi | last post by:
I don't know how to make a php script to work via cron...I want to make it run daily...My server API is CGI/Fast CGI.I have hosting from godaddy and in the help section i found that i have to specify the interpreter manually...look what it says: i've tried with /web/cgi-bin/php "$HOME/html/path/to/my/script.php as command and it doesn't work. if i run the script in browser it works...what should i introduce as a command..and do i have...
4
3960
by: Phil | last post by:
I have a php script that queries some Oracle DB and outputs a single line of plain text with <brat the end for each query. This is Apache2, php4.4.8 and Oracle Instant Client 10.1.0.5 all on CentOS 4.4 32bit. Php does run as an Apache SO. It works perfectly if I just hit the page in a web-browser (output to browser). It works *perfectly* from the command line (dumps the text to the file per the redirect)
3
1572
by: Zudnic | last post by:
Hi, long time listener, first time caller so to speak. Thanks to everyone who has answered other questions that I've found and used. I'm self-taught in Perl and have been hacking at it for more than five years now, so your patience with me is appreciated. Here's my issue. I have a Perl script (say, myscript.cgi) that is set to run on a cron job. It has a require line to another function library. (This is a procedural program, not OO):...
0
3488
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses do not inherit this value. From "man bash": Shell Variables The following variables are set by the shell:
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.