createObjFromXML($myURL); $now = time(); $remoteXml = $remoteWms->wms_getcapabilities_doc; // compare the capabilities XML documents $localXml = $capabilities_doc; if (!$remoteXml) { $result = -1; $comment = "Connection failed."; } elseif (!$localXml) { $result = 0; } else { if ($localXml == $remoteXml) { $result = 1; $comment = "WMS is stable."; } else { $result = 0; } } if ($result == 0) { $mywms = new wms(); if ($mywms->createObjFromXML($myURL)) { if ($auto_update) { $mywms->updateObjInDB($wmsId); $updated = "1"; $comment = "WMS has been updated."; } else { $comment = "WMS is not up to date."; } } else { $result = -1; $comment = "Invalid getCapabilities request/document or service exception."; } } } else { $result = -1; $comment = "Invalid upload URL."; $now = time(); } echo "wmsid: " . $wmsId . "\nupload_id: " . $upload_id . "\n"; echo "autoupdate: " . $auto_update . "\n"; echo "result: " . $result . "\ncomment: " . $comment . "\n"; echo "timestamp: " . $now . " (".date("F j, Y, G:i:s",$now).")\n"; echo "getCapabilities URL: " . $myURL . "\nupdated: " . $updated . "\n\n"; echo "-------------------------------------------------------------------\n"; echo "remote XML:\n\n" . $remoteXml . "\n\n"; echo "-------------------------------------------------------------------\n"; echo "local XML:\n\n" . $localXml . "\n\n"; echo "-------------------------------------------------------------------\n"; $sql = "UPDATE mb_monitor SET updated = $1, status = $2, status_comment = $3, upload_url = $4, timestamp_end = $5 WHERE upload_id = $6 AND fkey_wms_id = $7"; $v = array($updated, $result, $comment, $myURL, $now, $upload_id, $wmsId); $t = array('s', 's', 's', 's', 's', 's', 'i'); $res = db_prep_query($sql,$v,$t); ?>