php | 원격 서버의 특정 폴더에 파일 존재 여부 확인 함수
페이지 정보
작성자 100K5 작성일17-02-03 15:54 조회62,625회 댓글0건관련링크
본문
<?
$remot_file_name = "http://remote.server.com/vod/".$FindFile;
// 원격 서버 폴더에 파일 존재 확인 여부
function remoteFileExist($filepath) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$filepath);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(curl_exec($ch)!==false) {
return true;
} else {
return false;
}
}
if(remoteFileExist($remot_file_name) == 1) {
echo '파일이 존재하고 있습니다.';
}else{
echo '파일이 존재하지 않습니다.';
}
?>
댓글목록
등록된 댓글이 없습니다.