PHP 7 Script to Check If Remote Local File Exists Using Path and fopen() Function in Server Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

Welcome folks today in this blog post we will be checking if remote local file exists using path and fopen() function in server in php 7. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.php file and copy paste the following code

 

 

index.php

 

 

// Remote file url
$remoteFile = 'https://www.example.com/files/project.zip';

// Open file
$handle = @fopen($remoteFile, 'r');

// Check if file exists
if(!$handle){
    echo 'File not found';
}else{
    echo 'File exists';
}

Leave a Reply