BBM Tutor
BBM Tutor

PHP Zip - zip_entry_read()

Description & Uses of PHP zip_entry_read()

The PHP zip_entry_read() function is used to read a Content present in an opened Entry (a file) of an Zip Archive Resource Handler. It returns the Sub Resource Handler of a Content present in a Entry (a file) of a Zip Archive Resource Handler only if Success otherwise a PHP Warning.

Simple Example - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Invoice.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry */
$content = zip_entry_read($zipEntry);
echo("File Name: " . $file_Name . " is opened Successfully. ");
echo "<br><br>" ;
echo($content);

zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Invoice.txt is opened Successfully.

BBM Invoice provides a gateway to the Global business, we are providing 24 X 7 Customer Service, Customer Satisfaction, Maximum guaranteed uptime, high-powered service. We are providing this application in high secured encryption technique. This Online Application tool contains the bundles of Key Features.

bbminfo Demo Zip Archive File: Invoice.zip

  • It contains the following file
    • Invoice.txt
  • Download the Demo Zip Archive File: Invoice.zip for your tutorial reference purpose.
BBM Invoice

Simple PHP Syntax

<?php
zip_entry_read(Resource $zipEntry, Int $length);
?>

Parameter & Return Type

Description

Resource $zipEntry
Specifies the Resource Handler of a File in a Zip Archive. (*Required)
Int $length
Specifies the Bytes to be read from the Entry of the Zip Archive.
Return String $Content
Returns the File Content on success otherwise FALSE.

What is PHP zip_entry_read() ?

  • The PHP zip_entry_read() function reads the content from an opened Resource Handler of a Zip Archive Entry.
  • The Resourse Handler should read the default size of an Content or an User Defined Size of an Content. (Refer Example #1, #2 & #3)
  • The Size must be specified in Bytes.
  • The Default Size is 1024 Bytes. (Refer Example #3 & #4)
  • Initially the File Pointer is placed in the beginning of the File.
  • If PHP zip_entry_read() function is called more than one time within an Entry of a Zip Archive, it seeks the data to be displayed from the place where the last pointer was reffered by the PHP zip_entry_read() function and not from the begining of the input file. (Refer Example #6)
BBM Invoice

Example #1 - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Invoice.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry */
$content = zip_entry_read($zipEntry, 240);
echo("File Name: " . $file_Name . " is opened Successfully. ");
echo "<br><br>" ;
echo($content);
zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Invoice.txt is opened Successfully.

BBM Invoice provides a gateway to the Global business, we are providing 24 X 7 Customer Service, Customer Satisfaction, Maximum guaranteed uptime, high-powered service. We are providing this application in high secured encryption technique.

BBM Invoice

Example #2 - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Support.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry - Original Size */
$file_Size = zip_entry_filesize($zipEntry);
$content = zip_entry_read($zipEntry, $file_Size);
echo("File Name: " . $file_Name . " (Specifying the Original Size by using PHP zip_entry_filesize())");
echo "<br><br>" ;
echo($content);

zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Support.txt (Specifying the Original Size by using PHP zip_entry_filesize())

Online support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consumable job, we take the pain, and give you a great support and relief immediately. Email Support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consumable job, we take the pain, and give you a great support and relief immediately. Telephonic Support : We are always available at all the working days from 10:00 am (ISD) to 6:00 pm (ISD) to answer your calls directly. Direct Visit to Client's place : Sometimes, a face to face conversation will yield a good result than simply attending the problems and providing solutions. If the client wants us to meet them for a particular meeting or to attend a very urgent problem, we are always ready to provide this support, at an very affordable cost.

bbminfo Demo Zip Archive File: Support.zip

  • It contains the following file
    • Support.txt
  • Download the Demo Zip Archive File: Support.zip for your tutorial reference purpose.
BBM Invoice

Example #3 - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Support.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry without a Size */
$content = zip_entry_read($zipEntry);
echo("File Name: " . $file_Name . " (Without Specifying Size)");
echo "<br><br>" ;
echo($content);

zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Support.txt (Without Specifying Size)

Online support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consumable job, we take the pain, and give you a great support and relief immediately. Email Support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to

BBM Invoice

Example #4 - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Support.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry - Size: 1024 Bytes */
$content = zip_entry_read($zipEntry, 1024);
echo("File Name: " . $file_Name . " (Specifying 1024 Byte)");
echo "<br><br>" ;
echo($content);

zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Support.txt (Specifying 1024 Byte)

Online support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consumable job, we take the pain, and give you a great support and relief immediately. Email Support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to

BBM Invoice

Example #5 - PHP zip_entry_read(Resource $zipEntry, Int $length);

PHP Input Screen

<?php
$ZipHandler = zip_open("./Support.zip");
while($zipEntry = zip_read($ZipHandler)) {
$flg = zip_entry_open($ZipHandler, $zipEntry, "rb");
$file_Name = zip_entry_name($zipEntry);
if ($flg == true) {
/* Reading a File in a Zip Archive Entry without a Size */
$content_1 = zip_entry_read($zipEntry);
echo("File Name: " . $file_Name . " (Without Specifying Size)");
echo "<br><br>" ;
echo($content_1);
echo "<br><br><br>" ;

/* Reading a File in a Zip Archive Entry - Size: 250 Bytes */
$content_2 = zip_entry_read($zipEntry, 250);
echo("File Name: " . $file_Name . " (Specifying 1024 Byte)");
echo "<br><br>" ;
echo($content_2);
echo "<br><br><br>" ;

/* Reading a File in a Zip Archive Entry - Original Size */
$file_Size = zip_entry_filesize($zipEntry);
$content_3 = zip_entry_read($zipEntry, $file_Size);
echo("File Name: " . $file_Name . " (Specifying the Original Size by using PHP zip_entry_filesize())");
echo "<br><br>" ;
echo($content_3);
echo "<br><br><br>" ;

zip_entry_close($zipEntry);
} else{
echo("Failed to Open.");
}
}
zip_close($ZipHandler);
?>

PHP Output Screen

File Name: Support.txt (Without Specifying Size)

Online support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consumable job, we take the pain, and give you a great support and relief immediately. Email Support : Our preferred method of extending our support is simply land on to the client’s Server / PC. See what is the actual problem of a client and solve it. Earlier, the clients will send some sequences of emails explaining the problems, most of the time, the developer will understand in different way and suggest different solutions to


File Name: Support.txt (Specifying 250 Byte)

resolve the problem. And finally the client will stop asking questions and stop using the application. Go for a new one instead. We do not lead you into such a troublesome life. We simply land on into your server or PC, although it is a time consuma


File Name: Support.txt (Specifying the Original Size by using PHP zip_entry_filesize())

ble job, we take the pain, and give you a great support and relief immediately. Telephonic Support : We are always available at all the working days from 10:00 am (ISD) to 6:00 pm (ISD) to answer your calls directly. Direct Visit to Client's place : Sometimes, a face to face conversation will yield a good result than simply attending the problems and providing solutions. If the client wants us to meet them for a particular meeting or to attend a very urgent problem, we are always ready to provide this support, at an very affordable cost.

BBM Invoice
 
Disclaimer: Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.