AnsweredAssumed Answered

A2A Integration PHP

Question asked by wahyu.eko on Mar 10, 2016
Latest reply on Mar 11, 2016 by wahyu.eko

Hi all,

I have a question regarding A2A Integration with PHP

my code is:

 

<?php

$alias="A2ASQL";

$bypassCacheFlag="false";

$data = getCredential($alias,$bypassCacheFlag);

echo "Return code: $data[retCode]\n";

echo "User name: $data[user]\n";

echo "Password: $data[password]\n";

function getCredential($inAlias,$inFlag){

$exec = "/opt/cloakware/cspmclient/bin/cspmclient";

$command = "$exec $inAlias $inFlag";

$hndl=popen($command,'r') or die ("Unable to open pipe for command $command\n");

echo "About to execute command: $command\n";

$retVal=fread($hndl,2096) or die ("Unable to execute command $command\n");

$n = sscanf($retVal, "%s %s %s", $retCode, $user, $password);

$arr=array("retCode" => $retCode,

"user" => $user,

"password" => $password);

return $arr;

}

?>

 

I add a command in the php file to print the handler

$hndl=popen("/opt/cloakware/cspmclient/bin/cspmclient A2ASQL false","r") or die ("Unable to open pipe for command $command\n");

printf($hndl);

 

If i execute from terminal,its return Recource id #4

php1.png

But if i deploy that php file to webserver (apache2.2) and run from web browser, its return Resource id #2

and it cannot get credentials from server

php2.png

Anyone can help me?

Thank You

Outcomes