Hello,
I have a difficulty figuring out a way for one PHP file to get object information from another. This is my situation:
1. SOAP object is constructed in file1.php using a SOAP method call and its values are copied into $resp variable
2. file2.php has to get the $resp object's values.
I have already attempted creating a class client and instatiating its members with values obtained from SOAP calls
The problem is that in file2.php I would than have to re-create an instance of 'client' object:
file2.php
$client = new client();
$client->getClient(); // this will require complete SOAP request again which very time consuming
Please, let me know, is there a way to pass a ready-made $resp object from file1.php to file2.php without creating an instance in file2.php and calling its member functions again?
Please help,
Thank you,
Victor.
Please help a newbie with object passing
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Hello,
Sorry all, but my excitement was too premature. I tried using above suggestions but it doesn't seem to work for my problem. Perhaps if I clarify it a bit more it will be easier to find a solution:
I need to find a way on how to save a session and an object obtained in file1.php and use the session and object information in file2.php.
I cannot create a class and then instantiante it in file2.php because I am sending a SOAP request and with it I am getting that session and object information.
There are subsequent other SOAP API functions that I need to call using session and object information obtained in file1.php so:
Step 1:
CheckAvailability (uses object obtained in file1)
onClick="load file2.php?parameter=some parameters
Step 2:
Add Product
onClick="load file3.php?parameter= some parameters" <<< uses object/session information obtained from file1 AND CheckAvailability
Step 3:
BookProduct
onclick="load file4.php?parameter=some parameters" <<< uses object/session information obtained file1 AND CheckAvailability AND Add Product
Clearly, re-using the same class at Step3 part will be extremely inefficient because I have to call every previous procedure.
I hope I clearly defined my problem so it seems like the only way is to pass a resulting object/session from file to file as opposed to getting it from step 1. So the basic Idea: at Step 3 use object's values obtained in Step1 + Step2.
Ideally, I would just need to pass session and object information as parameter to each subsequent file. But I am not sure if it is possible.
Please help,
Thank you,
Victor.
Sorry all, but my excitement was too premature. I tried using above suggestions but it doesn't seem to work for my problem. Perhaps if I clarify it a bit more it will be easier to find a solution:
I need to find a way on how to save a session and an object obtained in file1.php and use the session and object information in file2.php.
I cannot create a class and then instantiante it in file2.php because I am sending a SOAP request and with it I am getting that session and object information.
There are subsequent other SOAP API functions that I need to call using session and object information obtained in file1.php so:
Step 1:
CheckAvailability (uses object obtained in file1)
onClick="load file2.php?parameter=some parameters
Step 2:
Add Product
onClick="load file3.php?parameter= some parameters" <<< uses object/session information obtained from file1 AND CheckAvailability
Step 3:
BookProduct
onclick="load file4.php?parameter=some parameters" <<< uses object/session information obtained file1 AND CheckAvailability AND Add Product
Clearly, re-using the same class at Step3 part will be extremely inefficient because I have to call every previous procedure.
I hope I clearly defined my problem so it seems like the only way is to pass a resulting object/session from file to file as opposed to getting it from step 1. So the basic Idea: at Step 3 use object's values obtained in Step1 + Step2.
Ideally, I would just need to pass session and object information as parameter to each subsequent file. But I am not sure if it is possible.
Please help,
Thank you,
Victor.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK