Reading php variables

I want my application to read the variables and SESSION from php pages.
the php code use this SESSION  to filter the data

I want my delphi application to read this SESSION .
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

that is almost impossible. that variable contains data that is generated and maintained by the PHP process. in order for yo to be able to access it, your delphi applicaiton must
1) run on teh same machine as the php process
2) know which page to get the Sessions data
3) know how php stores and manipulates the data

AND, hope that the data is saved by php to file, otherwise, if it's in memory you can say goodbye to the idea.
sal1150Author Commented:
OK, forget that idea.
Now I have "test.php" this page contain this code
<?php echo $tb_basic_data->employno->ViewValue ?>
the result was "1234".
How can I let my application read the result ("1234").
according to EE rules, you must open a new question for every new problem. you cannot mix them together.

like I anwsered this question, What happens if I cannot answer your second?
not to mention that if you are paying for the service, you are paying for a number of points. so asking questions reduces those points. asking many questions in one, could be like fraud if you look at the points system point of view.

and to answer your second question, that echo is outputing to a webpage. if your delphi application reads that webpage, it can parse the value out from the html generated for that page.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

sal1150Author Commented:
mr ciuly, I do not change the question. The second comment is to explain first one.

until now I donot understand.
in the first question, you ask about a session variable. in the second question, there is no session variable. I don't understand what you don't understand.

php runs on a specifc computer. on that computer runs a web server. that is how php serves the webpage.

your application also runs on a certain computer. IF, your application runs on a different computer then the one with the webserver and php, you CANNOT interact with php. you don't even see the php. all you see is the html page and any other http data served by the web server. nothing more.

IF, on the contrary, your application runs on the same computer as the web server and php, then you MIGHT be able to interact with PHP but it is very complicate dand depends on PHP. You will need to ask them, whomever wrote or maintains php if what you want can be done and if so, how.

so, having this said, what do you really want to do?
sal1150Author Commented:
I want to open (test.php) by explorer.then my application is ready to read the output.("1234').
note: my application is running on my computer.
CodedKSenior Software EngineerCommented:
Hi Sal1150.

As Ciuly already mentioned above you need to parse the web page.

- First of all based on the fact that you already know the output and where the requested data appears in the page i make the assumption that you know where exactly to find it among the other data.

- So all you need to do is to make your application read the specific address that outputs the data. For example :(http://www.mypage.php?value=20)...

- The way to read the whole page and then parse the data (you can either save the page to a file or parse it directly from the memory) is right here :
There are MANY components out there that can do the parsing for you. You only need to set the address and some code from your side to determine what data to delete and what data to keep...

Now that the data from the web page has been stored to the memory or a file all you need to do is parse it.
For example if the web page contains all this data :
<html><h1>1234</h1> </html>  <---- Store the webpage to a string for example mypage

You need a function to strip the html from this string... or use Copy
Example :
mypage := Copy (mypage,9,4);


From your question i can understand that you are the one that made this php file. I mean you know the variable name and all that.
If that is the case then why dont you store the output in a field in MySQL database and then with a SQL query ask for it....

Hope this helps.

why do you want to open it in explorer? use a TWebBrower component (it's on the internet palette) and open test.php in there by using
then in the navigatre complete event, parse the html for 1234
here's a tip on how to get the html string from there:
then you use pos and copy functions to extract 1234
sal1150Author Commented:
hi CodedK
yes I am who make the php file.
I am using the the output (employ no) to let my application to print fastreport.
BUT this application run by the users (more than 20 users).
CodedKSenior Software EngineerCommented:
There is no problem with that.... SQL can handle read request for more than 20 users :)

Does the server support MySQL?
Do you have any MySQL table for this page?
If that is the case then just add a field that will hold the value you want.

Then inside your program drop an DAC or similar component (AnyDAC is free and very very good).  
+ Connect to the database.
+ Execute a simple query like :
   "Select my_number_field from MyTable where something=something"
+ And store the result to a string.

This is it.
The alternative has already been posted above.

This is by far the best solution

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CodedKSenior Software EngineerCommented:
Sal1150, here comes the all time classic question !

Why the heck did you grade the answer with a B grade ?
You asked for something i didn't explain ?
I think i covered every possible aspect of your question. Am i wrong ?

Please post back if you can, i'm just curious why some persons grade with B.
Please read why B and C grades exists in this forum and then use it.
Also if you think more than one person helped you, then you should split the points.

If you need further explanations, just ask for it.

Bottom of line is ... You should protect your investment !!! So simple.
If you continue to grade people who help you like this, then you will pay for a service you wont receive !

Cheers :)
thanks for that, codedk. one more guy added to my list :)
CodedKSenior Software EngineerCommented:
... I don't know Ciuly...
I know you seen many things here but i understand very well how new to forum react to the grading system.
Unwillingly - unconsciously they put their self to a teacher position. This is not the fault of the person who asks a question. I think its E.E fault instead.
I know you took this issue all by yourself but i don't know if punishing some random askers will solve this. Anyways i love this forum, hope it'll get better.

>> i don't know if punishing some random askers will solve this

WE cannot solve this issue. EE is build ina stupid way from this point of view. Most of my suggestions, pretty good I would say, were ignored. (Well, one of them, cleaning up the help of all the redundant information was put into action, but nothing consistent towards the grading system.)

so what I am doing is not solving a problem but reducing the chance that I will encounter it again with certain askers. that's all to it.
I got sick of telling people how to grade properly, how to accept properly, what to do to change the grade and so on. You sign up for a forum, read the damn rules. You want to do something you never done before (like accepting an aswer) read everything there is to read on that page. the grading tips are right there.
it's that simple. The guy is too lazy to do that? has so little respect for me? then I don't care about his problems anymore. Let others help him and be given B/C grades. ANd shortly, there will be nobody left to help the guy.

It's about mutual respect. I take the time to solve your problem, for free (because a few points really worth almost nothing), then you show me at least an ounce of respect and accept and grade properly.

Am I asking for too much? In the eyes of EE admins and owners and staff and etc, apparently yes. Well, then I will ease my "pain" myself, my own way.
CodedKSenior Software EngineerCommented:
>>because a few points really worth almost nothing
Well to tell the truth absolutely nothing...

Anyway check this out , the ">" symbol from your page links to the last page, not the next. And the ">>" to the next one.  Nice project :D
CodedKSenior Software EngineerCommented:
>>cleaning up the help of all the redundant information was put into action..

Nice because its almost as long as the contract of buying and selling a company like Microsoft combined :)
>> Anyway check this out , the ">" symbol from your page

thanks for that :D
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.