aximbigfan Posted March 13, 2008 Share Posted March 13, 2008 I have a little issue here. I want to make a system where RSS URLs may be entered into a text box, then saved to a .ini file (parse_ini_file ()). then I want on a seperate page to be a drop down box, with the different URLs. I knwo how to do the majority of this, liek how to save the URLs, but lets say I save each url in the ini file as URL[1] = "" URL[2] = "" ect. How do I get PHP to figure out that it needs to loop and get the contents of each saved URL, then output them on a drop down box? Thanks, chris Link to comment https://forums.phpfreaks.com/topic/96065-generating-vars/ Share on other sites More sharing options...
Caesar Posted March 14, 2008 Share Posted March 14, 2008 If your file already looks like... URL[1] = "http://google.com/" URL[2] = "http://yahoo.com/" Then you can try.... <?php $url = explode("\n",file_get_contents($file)); foreach($url as $u) { preg_match('/URL\[[0-9]+\] \= \"([aZ-zZ0-9\_\:\/\.\~]+)\"/i', $u, $links[$i]); $urls[] = $links[$i][1]; $i++; } /* The $urls array will output the following... Array ( [0] => http://google.com/ [1] => http://yahoo.com/ ) */ ?> Link to comment https://forums.phpfreaks.com/topic/96065-generating-vars/#findComment-491835 Share on other sites More sharing options...
aximbigfan Posted March 14, 2008 Author Share Posted March 14, 2008 Thanks. I 'll try something like that... Chris Link to comment https://forums.phpfreaks.com/topic/96065-generating-vars/#findComment-491883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.