Browse code

API-Routine ausgelagert

Bernd Wurst authored on19/01/2018 23:00:25
Showing2 changed files
1 1
similarity index 71%
2 2
rename from modules/contacts/include/api.php
3 3
rename to modules/contacts/include/contactapi.php
... ...
@@ -16,31 +16,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
16 16
 
17 17
 require_once('contacts.php');
18 18
 require_once('inc/debug.php');
19
-
20
-function api_request($method, $input_data) 
21
-{
22
-    $url = config('http.net-apiurl').'domain/v1/json/'.$method;
23
-    $input_data['authToken'] = config('http.net-apikey');
24
-    DEBUG('======= API REQUEST ==========');
25
-    DEBUG($url);
26
-    DEBUG($input_data);
27
-    $curl = curl_init($url);
28
-    $json = json_encode($input_data);
29
-    curl_setopt($curl, CURLOPT_POST, 1);
30
-    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
31
-    curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
32
-    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
33
-    $result = curl_exec($curl);
34
-    if ($result === FALSE) {
35
-        system_failure("API-Anfrage kaputt");
36
-    }
37
-    DEBUG('==============================');
38
-    DEBUG($result);
39
-    $output_data = json_decode($result, true);
40
-    DEBUG($output_data);
41
-    return $output_data;
42
-}
43
-
19
+require_once('inc/api.php');
44 20
 
45 21
 
46 22
 function contact_to_apicontact($c) 
... ...
@@ -21,7 +21,6 @@ require_once('api.php');
21 21
 
22 22
 /*
23 23
 Todo:
24
-    - Wenn ein Domain-Handle aktualisiert wird, das beim Provider ändern
25 24
     - "separate Rechnungsadresse einrichten" / "Zusätzliche Adresse für den Notfall"
26 25
     - Domaininhaber festlegen    
27 26
 */