source: admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/n4d.php @ 1055

Last change on this file since 1055 was 1055, checked in by joamuran, 5 years ago

Initial import

File size: 1.7 KB
Line 
1<?php
2
3if(!session_id()) session_start();
4
5try{
6
7  //$credentials=$_POST["creds"];
8  //$class=$_POST["class"];
9  $method=$_POST["method"];
10  $args=json_decode($_POST["args"]);
11  //$args=$_POST["args"];
12  error_log("!!!!!!!!!!!!!!!".print_r($args, true)."****************");
13  error_log($method);
14  //$args=["lliurex", "lliurex"];
15  //error_log(print_r($args, true));
16
17  //error_log("method:$method\n args:$args\n");
18
19  header('Content-type: application/json');
20  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
21  header("Cache-Control: post-check=0, pre-check=0", false);
22  header("Pragma: no-cache");
23
24  //$args=array("", "VariablesManager");
25
26  $url='https://127.0.0.1:9779';
27  $request=xmlrpc_encode_request($method, $args);
28  error_log($request);
29  $header[] = "Content-type: text/xml";
30  $header[] = "Content-length: ".strlen($request);
31
32  $ch = curl_init();
33  curl_setopt($ch, CURLOPT_URL, $url);
34  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
35  curl_setopt($ch, CURLOPT_TIMEOUT, 10000);
36  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
37  curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
38
39  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
40  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
41  curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/n4dcert.pem");
42
43
44  $data = curl_exec($ch);
45  if (curl_errno($ch)) {
46    error_log("111111111111111111111111111111");
47    $xml_snippet=simplexml_load_string($data);
48    $json=json_encode($xml_snippet);
49    echo ($json);
50
51    } else {
52      error_log("2222222222222222222222222222222222");
53      $xmlobj=xmlrpc_decode($data);
54      $json=json_encode($xmlobj);
55      error_log($json);
56      echo ($json);
57    }
58
59} catch(Exception $e){
60  error_log("Exception!!!!!!!!!!!!!!: ".$e);
61}
62?>
Note: See TracBrowser for help on using the repository browser.