i'm trying to run file_put_contents instead of echo but I can not solve it.
This is my code:
$DOM = new DOMDocument();
$DOM->loadHTML($html);
$a = $DOM->getElementsByTagName('a');
foreach($a as $link){
echo $link->getAttribute('href').'<br />';
I tried to update echo $link->getAttribute('href').'<br />'; with file_put_contents("$project.txt", $link->getAttribute('href').'<br />'); but instead of getting something like this:
http://domain1.com/url-page-1/
http://domain2.com/url-page-2/
http://domain3.com/url-page-3
(...)
I got just this:
http://domain1.com/url-page-1/<br />
Any ideas?