Solved

Read txt File From Within Zip Using PHP

Posted on 2011-03-22
2
279 Views
Last Modified: 2012-05-11
Hi

What would be the best approach to reading a specific line from the header of a .txt file that is in a zip file?

Specifically Wordpress .txt, so you'll know the header for that is standard and I'm looking to get the version number but while the .txt file is still in the zip.

Would I simply need to extract that .txt to somewhere on my server?

Thanks
Ryan
0
Comment
Question by:Ryan Bayne
2 Comments
 
LVL 5

Accepted Solution

by:
tsmgeek earned 50 total points
ID: 35194768
Extract the file using the ZIP function in php...

http://uk.php.net/manual/en/function.ziparchive-extractto.php

then read your file into array line by line, check first entry of array for the data you want
0
 
LVL 2

Author Comment

by:Ryan Bayne
ID: 35197597
I thought so. I'll be providing this ability within a Wordpress plugin so wanted to make sure there was not an even shorter method but even if there was a php function for this, it would still just extract that file wouldn't it.

Thans
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now