diff options
Diffstat (limited to 'extras')
-rw-r--r-- | extras/import-idp.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/extras/import-idp.php b/extras/import-idp.php index 6ea9cb6..0b9adf1 100644 --- a/extras/import-idp.php +++ b/extras/import-idp.php @@ -20,7 +20,12 @@ $db = new mysqli($settings['host'], $settings['user'], $settings['password'], $s if ($db->connect_errno) die("Could not connect to db: " . $db->connect_error . "\n"); $db->set_charset("utf8"); -$url = 'https://www.aai.dfn.de/fileadmin/metadata/DFN-AAI-metadata.xml'; +if ($argc > 2) { + $url = $argv[2]; +} else { + $url = 'https://www.aai.dfn.de/fileadmin/metadata/DFN-AAI-metadata.xml'; +} +echo "Using $url...\n"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @@ -34,9 +39,15 @@ preg_match_all('#<EntityDescriptor.*?</EntityDescriptor>#s', $data, $out); foreach ($out[0] as $data) { $data = preg_replace('#<(/?)[a-zA-Z0-9]+:#', '<\1', $data); $xml = json_decode(json_encode(simplexml_load_string('<?xml version="1.0" encoding="utf-8" standalone="yes" ?>' . $data)), true); - if (!isset($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"])) continue; - if (!isset($xml["IDPSSODescriptor"]["Extensions"]["Scope"])) continue; - if ($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"] !== 'http://aai.dfn.de/category/bwidm-member') continue; + //if (!isset($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"])) { + // echo "no EntityAttributes.Attribute.AttributeValue!\n"; + // continue; + //} + //if ($xml["Extensions"]["EntityAttributes"]["Attribute"]["AttributeValue"] !== 'http://aai.dfn.de/category/bwidm-member') continue; + if (!isset($xml["IDPSSODescriptor"]["Extensions"]["Scope"])) { + echo "No Extensions.Scope!\n"; + continue; + } $scope = $xml["IDPSSODescriptor"]["Extensions"]["Scope"]; if (!is_array($scope)) $scope = array($scope); $name = $xml["IDPSSODescriptor"]["Extensions"]["UIInfo"]["DisplayName"]; |