I've been going nuts over the following piece of code for the past few hours,
what it does (or rather is supposed to do) is;
open a textfile containing links,
break it down into variables,
and then loop those variables using them to open two other files that also contain various information...
now the firsst fopen works as it should, but i can not for the life of me figure out what the problem is when it goes into the while loop... that's when i get the;
Warning: fopen(file.txt ) [function.fopen]: failed to open stream: Invalid argument in file.php on line xx
line xx being the first fopen in the while loop;
$fp = fopen($links, "r");
$fp = fopen($front, "r");
$front_file_contents = fread($fp, filesize($front));
fclose($fp);
$line = explode("\n", $front_file_contents);
$i = 0;
//while The file contains information do the following loop
while ($i < sizeof($line)) {
$links = "$line[$i]";
$fp = fopen($links, "r");
$content_file = fread($fp, filesize($links));
fclose($fp);
$content_links = explode("\n", $content_file);
$header_link = "$content_links[1]";
$article_link = "$content_links[2]";
$fp = fopen($header_link, "r");
$header_file = fread($fp, filesize($header_link));
fclose($fp);
$header = explode("\n", $header_file, 2);
$a_load = implode('', file($article_link));
echo $a_load;
$i++;
}
Any insight into the matter would be highly appreciated 😛 really 🆒