PHP parsing certain lines of a text file - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: PHP parsing certain lines of a text file (/showthread.php?tid=92982) PHP parsing certain lines of a text file by Jimbo on 11-22-2009 at 07:13 PM
Hey there, quote:But only parse the ad number and the section after the word "text". For example, in the above document, it would parse: quote:Thanks RE: PHP parsing certain lines of a text file by John Anderton on 11-22-2009 at 07:22 PM
Use regexp and read up on your preg_match_all RE: PHP parsing certain lines of a text file by prashker on 11-22-2009 at 07:59 PM
This would be so much easier if the system making the text file used json_encode, and decrypted it with json_decode RE: PHP parsing certain lines of a text file by Jimbo on 11-23-2009 at 12:07 AM
Thanks, and yeah, I cannot change the original text file as its read by something else, that can only read in that format. Anway, I managed to come up with this: PHP code: Yes, pretty fail way of doing it, especially the <li> part, but hey, it works RE: PHP parsing certain lines of a text file by NanaFreak on 11-23-2009 at 12:36 AM
if you want you can just do it like this: code: its a better way of doing the list, and maybe a little safer with the finding of the text [= RE: PHP parsing certain lines of a text file by Jimbo on 11-23-2009 at 11:45 PM
Thanks NanaFreak RE: PHP parsing certain lines of a text file by NanaFreak on 11-24-2009 at 12:32 AM
you are either able to hard code that information, but if you want to make it dynamic, you can add another element to the text document... code: method 2: text document: code: php file: code: hope this help [= RE: PHP parsing certain lines of a text file by Jimbo on 11-24-2009 at 08:03 AM
Thanks again nanafreak PHP code:It works fine, however, when searching for someone who has multiple records, it finds all records, but has some huge space before they are displayed. You can try this at http://sammyservers.com/reports/ . Try searching for example "sakura", which works fine, and then try "zombie". You will see the difference. RE: PHP parsing certain lines of a text file by NanaFreak on 11-24-2009 at 08:40 AM
would you be able to post all of the code for the search.php page, as the stuff you have posted doesnt seem to be enough and some parts are missing... RE: PHP parsing certain lines of a text file by WDZ on 11-24-2009 at 09:05 AM
HTML code:What's that <br> doing in there, outside of a table cell? RE: PHP parsing certain lines of a text file by Jimbo on 11-24-2009 at 03:22 PM
@Nana, what I posted above is the whole search.php. HTML code:on the main page. I dont know how I missed that <br>, that fixed it Thanks WDZ RE: PHP parsing certain lines of a text file by NanaFreak on 11-25-2009 at 12:38 AM
quote:it isnt because nowhere on that page is there this html: HTML code: RE: PHP parsing certain lines of a text file by John Anderton on 11-25-2009 at 06:29 AM
quote: Well spotted, sir. You deserve a cookie! RE: RE: PHP parsing certain lines of a text file by Jimbo on 11-25-2009 at 07:57 AM
quote:Well, I removed the 2 div elements as they wouldnt matter, but apart from that, its the whole code RE: PHP parsing certain lines of a text file by NanaFreak on 11-25-2009 at 09:24 AM btw, i just tested it again and it worked fine... =\ RE: PHP parsing certain lines of a text file by segosa on 12-14-2009 at 11:15 PM Also, read about sql injection. |