
Hi..I'm getting problem to store the output of this php code into multiple text files. Can anyone sugeest. Here is my code:
<?php
for($i=1; $i<=100; $i++)
{
$html = file_get_contents("$i.html");
$dom = new DOMDocument;
//Parse the HTML. The @ is used to suppress any parsing errors
@$dom->loadHTML($html);
$links = $dom->getElementsByTagName('a');
foreach ($links as $link){
$output= $link->getAttribute('href'), '<br>';
}
$ourFileName = "$i.txt";
$fp = fopen("$i.txt", "w");
fputs ($fp, $output);
fclose($fp);
}
?>`
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
