Irishph4nt0m16 Posted February 24, 2016 Share Posted February 24, 2016 (edited) Hi I need help with something. I'm looking to read a .txt file that has names with links inside that points to streams. I'm wanting them to be displayed as a dropdown <select> box. Text file is like this: Title 1 http://host/title1.m3u8 Title 2 http://host/title2.m3u8 Title 3 http://host/title3.m3u8 etc etc etc..... Output needed: <select> <option value="http://host/title1.m3u8">Title 1</option> <option value="http://host/title2.m3u8">Title 2</option> <option value="http://host/title3.m3u8">Title 3</option> </select> I've been trying to do this for a few hours now and everything I try, Im only getting 1 option working the rest are non-existing. The reason I need this is because the links update every week and they are a total of 800 streams. Entering those in one by one isn't a option I willing to take. Edited February 24, 2016 by Irishph4nt0m16 Quote Link to comment https://forums.phpfreaks.com/topic/300878-php-txt-file-to-strings/ Share on other sites More sharing options...
requinix Posted February 24, 2016 Share Posted February 24, 2016 Without any error checking, $h = fopen("file.txt", "rt"); while (!feof($h)) { $title = trim(fgets($h)); $url = trim(fgets($h)); // output } fclose($h); Quote Link to comment https://forums.phpfreaks.com/topic/300878-php-txt-file-to-strings/#findComment-1531435 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.