The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to download files from a site? paqman Linux 2 11-26-2008 04:44 PM
script for download files from ftp site tiff-matt Shell Programming and Scripting 5 09-19-2008 03:46 PM
How to reconnect to online database? vanitham High Level Programming 1 10-27-2007 10:29 AM
Online site on Makefile bkausik High Level Programming 2 02-18-2002 05:05 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-06-2009
vanitham vanitham is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 56
Reconnect and download data from online site

Hi,

I have to connect to online site and download some data from the online site but sometimes the site which i have to connect will be busy
or it will not be working in such a case i have to connect atleast 3 times and try to download the data.

I tried like this:


Code:

use CGI::Carp qw(fatalsToBrowser);

$url="http://www.xyz.com";

$ua = new LWP::UserAgent;

$tries=0;

eval
{
$response=$ua->get($url);
};warn $@ if ($@);
if ($@) {
         die "Server error: $@.  Try again later" ;
         $tries++;
	 if($tries == "3")
	 {

		print "\nstop connecting\n"
	 } 
     }

Actually i am stuck up here if there is any error it is not displaying i.e its not
entering if($@) block . How to reconnect again???

Basically i have to reconnect and download the data when the site is not working.

How to reconnect to the site and download the data???


Any suggestions ???


Regards
Vanitha

Last edited by Franklin52; 05-06-2009 at 05:34 AM.. Reason: code tags
  #2 (permalink)  
Old 05-06-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,560
that's because you use die.
  #3 (permalink)  
Old 05-06-2009
vanitham vanitham is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 56
Quote:
Originally Posted by ghostdog74 View Post
that's because you use die.
Hi,

Thanks for the reply!!

what should i use?

I removed die but still its not working!

How can i reconnect and download data?


Regards
Vanitha
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0