--- a/admin/importSON.php
+++ b/admin/importSON.php
@@ -1,1 +1,50 @@
+loadHTML(file_get_contents("https://www.tenders.gov.au/?event=public.advancedsearch.CNSONRedirect&type=sonSearchEvent&SONID=$SONID"));
+
+# Iterate over all the tags
+ foreach ($search->getElementsByTagName('a') as $link) {
+ # Show the
+ if (strpos($link->getAttribute('href'), 'UUID')) {
+ echo $link->getAttribute('href');
+ @$doc->loadHTML(file_get_contents("https://www.tenders.gov.au".$link->getAttribute('href')));
+ }
+ }
+
+ //TODO update title from $x("//p[@class='lead']/text()")
+
+
+ $sql='insert into standingoffer_suppliers("SONID",name,abn,state,postcode) values(?,?,?,?,?)';
+ $q=$conn->prepare($sql);
+
+ foreach($doc->getElementsByTagName('tr') as $row) {
+ $supplier = Array("SONID"=>$SONID);
+ $i = 0;
+ foreach ($row->childNodes as $column){
+ //echo $i;
+ if ($i==0) $supplier['name'] = $column->textContent;
+ if ($i==2) $supplier['abn'] = trim(str_replace(' ','',$column->textContent));
+ if ($i==4) $supplier['state'] = $column->textContent;
+ if ($i==6) $supplier['postcode'] = $column->textContent;
+ //echo $column->textContent;
+ $i++;
+ }
+ //print_r($supplier);
+ $q->execute(array_values($supplier));
+ }
+}
+if ($_REQUEST['SONID']) {
+ fetchSON($_REQUEST['SONID']);
+}