--- a/admin/downloadExports.php +++ b/admin/downloadExports.php @@ -1,1 +1,28 @@ +loadHTML(file_get_contents("https://www.tenders.gov.au/?event=public.reports.listCNWeeklyExport")); + +$xpath = new DOMXPath($search); +$ls_ads = $xpath->query('//div[@class=\'list-datalist\']'); +foreach ($ls_ads as $ad) { +# Iterate over all the tags + $i=0; + foreach ($ad->getElementsByTagName('a') as $link) { + # Show the + if (strpos($link->getAttribute('href'), 'UUID') && $i < 4) { + echo $link->getAttribute('href')."\n"; + //@$doc->loadHTML())); + $myfile = fopen("data/AustenderExport-".$link->textContent.".xls", "w") or die("Unable to open file!"); + fwrite($myfile, file_get_contents("https://www.tenders.gov.au" . $link->getAttribute('href'))); + fclose($myfile); + $i++; + } + + } +} +