Archived
This forum has been archived. Please start a new discussion on GitHub.
PHP Returned Result into slice struct
How do you place the returned result from server call into a struct in PHP?
I see page with example of writing a slice struct to the server, but not how to
retrieve the data: http://www.zeroc.com/icephp.htmlb
This is likely due to my unfamilarity with PHP. I've been working
on the c++ server and clients, and am now trying to produce a simple PHP test page.
slice fragment:
module CU
{ // System Login Info
struct System {
bool loggedIn;
int postdate;
string sysname;
string syslocation;
int sysflags;
string username;
int userid;
int userbranch;
string userlocation;
int userflags;
};
interface CULoan
{
System login(int userid, string pw) throws InvalidUser;
};
};
PHP Page fragment:
elseif(isset($_POST["login"]))
{
$sysrec = $gcu->login(148, "junkjunk");
foreach ($sysrec as $s => $val)
echo "<B>\t" . $s . " = " . $val . "<BR></B>\n";
}
PHP Page results returned:
loggedIn = 1
postdate = 2006-04-02
sysname = GNU FCU
syslocation = Worcester
sysflags = 1862869560
username = Carol Jones
userid = 148
userbranch = 75
userlocation = Marlboro
userflags = 1768187255
OK
I would like these results into a struct of type System.
I see page with example of writing a slice struct to the server, but not how to
retrieve the data: http://www.zeroc.com/icephp.htmlb
This is likely due to my unfamilarity with PHP. I've been working
on the c++ server and clients, and am now trying to produce a simple PHP test page.
slice fragment:
module CU
{ // System Login Info
struct System {
bool loggedIn;
int postdate;
string sysname;
string syslocation;
int sysflags;
string username;
int userid;
int userbranch;
string userlocation;
int userflags;
};
interface CULoan
{
System login(int userid, string pw) throws InvalidUser;
};
};
PHP Page fragment:
elseif(isset($_POST["login"]))
{
$sysrec = $gcu->login(148, "junkjunk");
foreach ($sysrec as $s => $val)
echo "<B>\t" . $s . " = " . $val . "<BR></B>\n";
}
PHP Page results returned:
loggedIn = 1
postdate = 2006-04-02
sysname = GNU FCU
syslocation = Worcester
sysflags = 1862869560
username = Carol Jones
userid = 148
userbranch = 75
userlocation = Marlboro
userflags = 1768187255
OK
I would like these results into a struct of type System.
0
Comments
-
Hi Don,dthompson wrote:I would like these results into a struct of type System.
echo "The type of sysrec is " . get_class($sysrec) . "\n"; echo "The value of sysname is " . $sysrec->sysname . "\n";
Hope that helps,
- Mark0