I am trying to create a simple index of links to txt files I have uploaded. I want them to be discovered by the search engine. I believe my code is correct as it is a simple open and then write to the file. The error appears to be the server blocking the write. I haven’t had issues with other functions so am wondering what is blocking me. I haven’t found any other help files to help someone so new to writing code in general. Thanks.
<?php
echo "<br>", "Now building index file to link new articles to the search engine<br>";
$findex="index_csv.csv";
$annaindex="index.html";
fopen($annaindex,"w");
if (($handle=fopen ($findex, "r")) !==FALSE)
{
while(($line = fgetcsv($handle)) !== FALSE)
{
list($totstring, $totlen, $period, $http, $lenanna, $lentitle, $post, $title, $fnamelen, $old,$fnameless, $bat, $pdate) = $line;
$new=$post . "_". $fnameless . ".txt";
echo "Now processing $new", "<br>";
$annalink = '<a href=\"' . $new. '\">'. $title . '</a>/n';
echo $annalink, "<br>";
fwrite ($annaindex,$annalink);
}
}
//*****************************************************
fclose($handle);
fclose($annaindex);
echo "finished creating file";
?>
- Formatted by Admin