Logo.CortexAG

Anmelden +

PHP-Beispiel zur Portalabfrage

<?
//*** url to call the dataservice in the correct database ***//
$url = 'http://localhost/i/UniPlexDataservice/updjsr.php';

//*** Request-ID to identitfy the correct returned json object ***//
$iRequestID = 1;



//*** Begin: User-Handle ***//

//*** request user login for the dataservice ***//
$jRequest = array('method'   => 'getLogin',
                  'requestid' => $iRequestID,
                  'param'     => array(
                        'user' => 'admin',
                        'pass' => 'admin',
                        'app' => 'UniplexDataservice'
                  )
            );
//*** parameter-array for php-function 'stream_context_create' ***//
$CONTEXT_OPT = array(
  'http' => array( 'method' => 'POST',
                   'content' => json_encode($jRequest),
                   'header'=> 'Content-Type: application/json\r\n' .
                   'Accept: application/json\r\n')
                  );

//*** create context params for php-function 'file_get_contents' ***//
$context = stream_context_create( $CONTEXT_OPT );

//*** get contents with params and decode json-object ***//
$jRes = file_get_contents( $url, false, $context );
$aRes = json_decode($jRes, true);


$sUsrHdl = $aRes['result']['data']['UpdJsrHdl'];

//*** End: User-Handle ***//



//*** Begin: portal call ***//

//*** request definition for the dataservice ***//
$jRequest = array('method'   => 'getPortalRows',
                 'requestid' => $iRequestID,
                 'param'     => array(
                      'portal' => 'Schulung-einfach',
'UpdJsrHdl' => $sUsrHdl
                 )
           );

//*** parameter-array for php-function 'stream_context_create' ***//
$CONTEXT_OPT = array(
  'http' => array( 'method' => 'POST',
                  'content' => json_encode($jRequest),
                  'header'=> 'Content-Type: application/json\r\n' .
                  'Accept: application/json\r\n')
                 );

//*** create context params for php-function 'file_get_contents' ***//
$context = stream_context_create( $CONTEXT_OPT );

//*** get contents with params and decode json-object ***//
$jRes = file_get_contents( $url, false, $context );
$aRes = json_decode($jRes, true);

//*** End:portal call ***//


//*** print result ***//
print_r($aRes);

?>

 

 Hinweise zur Online-Hilfe
 

© 2017 Cortex AG
(letzte Aktualisierung: 12.04.2017)

 Haftungsausschluss 

Impressum    AGB