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 Quote Link to comment 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/ ) */ ?> Quote Link to comment 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 Quote Link to comment 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.