This piece of code gets all the required links, now I want to save them in a file and can't figure out how to do this. Any help would be appreciated.
Code:
<?php
include_once('simple_html_dom.php');
// Get Contents with Multiple Links
$page1 = file_get_html('http://www.example.com/link1.html');
$page2 = file_get_html('http://www.example.com/link2.html');
$page3 = file_get_html('http://www.example.com/link3.html');
$html = str_get_html($page1.$page2.$page3);
// Find all links in cat_listings_title div
foreach($html->find('a.cat_listings_title') as $element)
echo $element->href . '<br>';
?>