Results 1 to 2 of 2

Thread: PHP Returned Result into slice struct

  1. #1
    dthompson is offline Registered User
    Name: Don Thompson
    Organization: Digital Federal Credit Union
    Project: credit card fraud monitoring
    Join Date
    Aug 2005
    Location
    south shore mass
    Posts
    10

    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.
    Don Thompson
    Digital Federal Credit Union
    www.dcu.org
    Ice Project: credit union core processing prototype which may expand to open source project.
    Current Environment:
    Debian Linux Sarge,
    mysql 4.1.11-Debian,
    mysql++ v 2.1.0.beta1,
    qt3 v 3.3.4,
    Ice-3.0.1
    IcePHP-3.0.1
    Server: c++ using mysql++ to access mysql db, with Ice interfaces.
    Desktop Client: c++ using qt3, Ice interfaces to Server
    Home Banking Client: Python using IcePy interface to Server
    Currently using PHP Client

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Don,

    Quote Originally Posted by dthompson
    I would like these results into a struct of type System.
    The return value of login is an instance of a PHP class that represents your struct type System. It just so happens that PHP5 allows you to iterate over objects using the foreach keyword, just like for arrays. To confirm this, add the following code:
    Code:
    echo "The type of sysrec is " . get_class($sysrec) . "\n";
    echo "The value of sysname is " . $sysrec->sysname . "\n";
    Hope that helps,
    - Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to Load ice.slice in PHP-Code?
    By oVi in forum Help Center
    Replies: 1
    Last Post: 08-28-2009, 11:35 AM
  2. latency result
    By leoang in forum Help Center
    Replies: 12
    Last Post: 07-21-2006, 07:01 AM
  3. php ice interface struct initialization
    By dthompson in forum Help Center
    Replies: 1
    Last Post: 05-17-2006, 05:18 PM
  4. is there any way to use my own struct in slice?
    By pi1ot in forum Help Center
    Replies: 1
    Last Post: 02-20-2005, 11:35 PM
  5. May slice struct contain class?
    By minifat in forum Help Center
    Replies: 1
    Last Post: 08-09-2004, 09:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •