Follow the following codes.
Install Guide.
Example:
PHP
<?php
$url = 'https://downloads.wordpress.org/plugin/wpforms-lite.1.9.2.1.zip';
$destination_dir = 'path/';
if (!is_dir($destination_dir)) {
mkdir($destination_dir, 0777, true);
}
$local_zip_file = basename(parse_url($url, PHP_URL_PATH)); // Will return only 'some_zip.zip'
if (!copy($url, $destination_dir . $local_zip_file)) {
die('Failed to copy Zip from ' . $url . ' to ' . ($destination_dir . $local_zip_file));
}
// Change the txt file location which is inside of the zip file Example: #wpforms-lite/readme.txt
$result = file_get_contents('zip://path/'.$local_zip_file.'#wpforms-lite/readme.txt');
# Display txt file's texts
echo '<xmp>'.$result.'</xmp>';
$result = file_get_contents('zip://path/'.$local_zip_file.'#readme.txt');
echo $result;
$zip = new ZipArchive();
if ($zip->open($destination_dir . $local_zip_file)) {
$zip->close();
// Clear zip from local storage:
unlink($destination_dir . $local_zip_file);
}
?>
How to read a text file inside zip file of a remote url using PHP | PHP Extract Tutorial |
How to extract Domain Name from Full URL in PHP | PHP Extract Tutorial |
How to extract only name from domain in PHP | PHP Extract Tutorial |
How to extract All url from a single page by PHP | PHP Extract Tutorial |
How to get first Five Line from CSV File | PHP Extract Tutorial |
How to get first 100 records from a csv file in PHP | PHP Extract Tutorial |
How to get meta Tag | PHP Extract Tutorial |
How to get title description image and multiple images from URL | PHP Extract Tutorial |
How to read a txt file from a zip remote URL | PHP Extract Tutorial |
How to extract all url from a html single page in PHP | PHP Extract Tutorial |
Type: | Php |
Category: | Web Tutorial |
Sub Category: | PHP Extract Tutorial |
Uploaded by: | Admin |