PeterdeB
asked on
Why is this 'not a valid stream resource?'
Hi Folks,
Check out the code snippet below. When run from within PHP Expert Editor I get the following message for each line it should write into the file url.dat.
Warning: fclose(): 2 is not a valid stream resource in F:\test.php on line 65
Anyone any clues?
Kind regards,
Dweep
Check out the code snippet below. When run from within PHP Expert Editor I get the following message for each line it should write into the file url.dat.
Warning: fclose(): 2 is not a valid stream resource in F:\test.php on line 65
Anyone any clues?
Kind regards,
Dweep
$regels= fopen('url.dat', 'w');
for($i=1;$i<(count($urls))+1;$i++)
{
if (!stristr($urls[$i],$sGoogle))
{
fputs($regels, $urls[$i])."\n";
}
fclose($regels);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
ASKER
Hernst42 thanks for responding, I tried your code but it didn't solve the problem.
Dr Dedo > I put the fclose outside the loop and that solved the problem.
Kind regards,
Dweep
Dr Dedo > I put the fclose outside the loop and that solved the problem.
Kind regards,
Dweep
Open in new window