master
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

10) 
11) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
12) */
13) 
14) require_once('inc/debug.php');
15) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

16) function api_request($method, $input_data)
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

17) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 5 months ago

18)     $url = config('http.net-apiurl') . 'domain/v1/json/' . $method;
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

19)     $input_data['authToken'] = config('http.net-apikey');
20)     DEBUG('======= API REQUEST ==========');
21)     DEBUG($url);
22)     DEBUG($input_data);
23)     $curl = curl_init($url);
24)     $json = json_encode($input_data);
25)     curl_setopt($curl, CURLOPT_POST, 1);
26)     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
27)     curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

28)     curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
Bernd Wurst JSON-API-Routine für http.n...

Bernd Wurst authored 6 years ago

29)     $result = curl_exec($curl);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

30)     if ($result === false) {