HarryMW Posted February 18, 2011 Share Posted February 18, 2011 Hello there, I am currently trying to code something for a lil' project I have been hood-winked in to and I could do with some help, probably silly things but it's driving me nutty. Firstly I need to connect to a text file which is online. So it won't be in a local directory but actually online and being updated whenever it is called. Secondly, I need to separate skip out the lines that start with the character ";", and also try to separate the different parts of the text file with headers that start with "!GENERAL", for example. There will be hundreds of entries so the results will need to be paginated obviously by 50 per page or something, if that's possible, hope so. Oh and the lines will have about 30 different pieces of information that will need to be inputted into a db and updated if the information is older that whats currently in the db. All of the sets of data are separated by this character ":". Any help will be appreciate, send me an e-mail on my address in my profile if you fancy giving me a quick hand at some point, thanks in advance. Harry. Quote Link to comment https://forums.phpfreaks.com/topic/228145-skipping-lines-and-text-files/ Share on other sites More sharing options...
Jerred121 Posted February 24, 2011 Share Posted February 24, 2011 need an example of the text file. Quote Link to comment https://forums.phpfreaks.com/topic/228145-skipping-lines-and-text-files/#findComment-1179188 Share on other sites More sharing options...
Jerred121 Posted February 24, 2011 Share Posted February 24, 2011 I'm not nearly as good with REGEX as some of the REGEX ninjas on here, but this worked for me when trying to remove the semicolon lines: $ptn = "/[^;](?:.*)\n/"; preg_match_all($ptn, $str, $match); foreach($match[0] as $key => $value){ echo "$value <br />"; // do whatever you want with the lines that don't start with ; } Quote Link to comment https://forums.phpfreaks.com/topic/228145-skipping-lines-and-text-files/#findComment-1179207 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.