2014-04-09 3 views
0

url을 사용하여 원격 서버에서 파일을 가져 오려고합니다.오류 : 가져 오기를 실패했습니다! HTTP 응답 : 503 서비스를 사용할 수 없음 [503 서비스를 사용할 수 없음]

CODE :

use File::Fetch; 
use strict; 

my $url = 'http://***********/all-bin/ASNvx14173/JAKASUSI_BUP_IIR009.doc'; 
$ENV{HTTP_proxy}=$proxy_url; 
my $ff = File::Fetch->new(uri => $url); 
my $where = $ff->fetch(to => "/temp"); 
my $file = $ff->file; 
my $error=$ff->error(); 
    print "result=$error\n"; 
    print "Error==>$url==>$error\n"; 
    if($error){ 
    $logger->error("Not fetching attachments!! - $error\n FILE $id : $url\n"); 
    } 
    next if ($error ne ""); 
    delete $ENV{HTTP_proxy}; 

오류는

Fetch failed! HTTP response: 503 Service Unavailable [503 Service Unavailable] at ./bin/convert_to_csv.pl line 911 thread 1. 
Fetch failed! HTTP response: 503 [Service Unavailable] at ./bin/convert_to_csv.pl line 911 thread 1. 

이 오류를 처리 할 수 ​​아니에요. 또한 특정 파일을 가져올 시간 제한을 설정하는 방법은 무엇입니까? 그것을 어떻게 다루는 지 도와주세요.

+0

./bin/convert_to_csv.pl의 911 줄은 무엇입니까? – DeVadder

답변

0

This page에는 File :: Fetch에 대한 설명서가 있습니다.

this을 살펴보십시오.

Returns the full path to the downloaded file on success, and false on failure.

문제가있는 경우 false 위치를 확인해야합니다.

my $where = $ff->fetch(to => "/temp"); 
if (!$where) { 
    my $error=$ff->error(); 
    print "result=$error\n"; 
    print "Error==>$url==>$error\n"; 
    $logger->error("Not fetching attachments!! - $error\n FILE $id : $url\n"); 
} 
else { 
    my $file = $ff->file; 
    # do stuff with file 
} 

또한 this은 TIMEOUT을 값으로 설정하는 것에 대해 설명합니다. $File::Fetch::TIMEOUT = $value_in_seconds;

관련 문제