adredd Posted February 28, 2007 Share Posted February 28, 2007 Hi All, Not even sure if I need to do this with php, but I'm thinking perhaps so... I've got a pipe delimited text file that looks something like this: TX55|M/SUNNY|72|68|73|21|S|9|N/A|10|02| TX56|P/CLOUDY|79|76|79|48|S|13|N/A|10|03| TX57|SUNNY|73|69|73|28|SSE|13|29.83|10|01| TX58|SUNNY|77|77|77|38|SE|12|29.72|10|01| There's about 100 lines to it. What I need to do is pull out the line that begins with "TX58" and put it into some sort of useable format (this is all weather information) to put on a website dynamically. This info gets uploaded to us 6 times a day or somesuch. Is this something that's doable with php, and if so, how (or rather, where/what do I Google for)? I just don't know enough about php to even know where to begin looking. Many thanks in advance! Link to comment https://forums.phpfreaks.com/topic/40434-newbie-alert-parsing-pipe-delimited-text-file/ Share on other sites More sharing options...
ikmyer Posted February 28, 2007 Share Posted February 28, 2007 the following links should get you what you need... http://us2.php.net/manual/en/function.fopen.php - open a file to read http://us2.php.net/manual/en/function.fgets.php - read the file ( line by line ) http://us2.php.net/manual/en/function.substr.php - pull the first few characters and see if they == TX58 Link to comment https://forums.phpfreaks.com/topic/40434-newbie-alert-parsing-pipe-delimited-text-file/#findComment-195660 Share on other sites More sharing options...
artacus Posted February 28, 2007 Share Posted February 28, 2007 and explode() to split the line into a usable array. Link to comment https://forums.phpfreaks.com/topic/40434-newbie-alert-parsing-pipe-delimited-text-file/#findComment-195675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.