Jan Behrens 1 year ago
parent
commit
245695bc2e
2 changed files with 10 additions and 11 deletions
  1. 3 3
      poll_database.php
  2. 7 8
      update_database.php

+ 3 - 3
poll_database.php

@@ -191,13 +191,13 @@
     // build HTTP context
     $context = stream_context_create([
         'http' => [
-            'header' => //"Authorization: Basic " . base64_encode("$username:$password") . "\r\n" .
+            'header' => "Authorization: Basic " . base64_encode("$username:$password") . "\r\n" .
                         "Connection: close" . "\r\n",
         ],
     ]);
 
-    //$KDB_API_URL = "https://kdb.kaas.kit.edu/kdb-api.fcgi/json";
-    $KDB_API_URL = "http://localhost:9999/json";
+    $KDB_API_URL = "https://kdb-test.kaas.kit.edu/kdb-api.fcgi/json";
+    //$KDB_API_URL = "http://localhost:9999/json";
 
     $counter = 0;
     $calltime = time();

+ 7 - 8
update_database.php

@@ -261,25 +261,24 @@
         }
     }
 
-    echo "Request payload (JSON):" . PHP_EOL;
-    var_dump($json);
+    //echo "Request payload (JSON):" . PHP_EOL;
+    //var_dump($json);
 
     // build HTTP context
     $context = stream_context_create([
         'http' => [
             'method' => 'POST',
-            'header' => //"Authorization: Basic " . base64_encode("$kdb_username:$kdb_password") . "\r\n" .
+            'header' => "Authorization: Basic " . base64_encode("$kdb_username:$kdb_password") . "\r\n" .
                         "Content-type: application/json" . "\r\n" .
                         "Connection: close" . "\r\n",
             'content' => json_encode($json),
         ],
     ]);
 
-    //$KDB_API_URL = "https://kdb-test.kaas.kit.edu/kdb-api.fcgi/json/write";
-    $KDB_API_URL = "http://localhost:9999/json/write";
+    $KDB_API_URL = "https://kdb-test.kaas.kit.edu/kdb-api.fcgi/json/write";
+    //$KDB_API_URL = "http://localhost:9999/json/write";
 
     echo "Updating database." . PHP_EOL;
-    // new kdb.kaas.kit.edu added and optimized readout parameters
     $fileip = file_get_contents($KDB_API_URL, false, $context);
 
     //echo $fileip . PHP_EOL;
@@ -291,8 +290,8 @@
     }
 
     $json = json_decode($fileip, true);
-    echo "Database result (JSON):" . PHP_EOL;
-    var_dump($json);
+    //echo "Database result (JSON):" . PHP_EOL;
+    //var_dump($json);
 
     if ($errorcount > 0) {
         echo $errormessage;