The following script works fine. When attached to a webpage it will seek the "meta description" then make a copy of its self named with the meta info it has found.
What I have been attempting to do is run this script and have it rename all files in a folder. The hard part has been getting the script to read each file and rename it using the meta description from that file.
Basically as opposed to adding the script to each file and running the page does anyone know how to just run the code and have it process all the pages in the DIR as if the php script was included in that file?
Apologies if what I need is not clear.
Attached is a file . When ran the php will make a copy of that file with. Renamed using the meta description and a random number.
I would like to have it rename all the file in the DIR the same way.
Thank you in advance you assistance is greatly appreciated.
srand ((double) microtime( )*1000000);
$random_number = rand(0,100);
$str = file_get_contents(__FILE__);
$aa = "--";
$ab = "_";
preg_match('%<meta name=\"description\" content=\"([^"]*)"%',$str,$matchArray);
$namesArray = explode(",",$matchArray);
$file = fopen($namesArray.$random_number.$ab.$namesArray.$aa.$namesArray.$ab.$namesArray.".php","w+");