Question and help with communicating with delphi and php

Hi I have designed a chatroom now a user can register on delphi and login on my delphi application all linked to me dedicated servers sql.
Now, when they have logged in they can see lobby rooms called:

Room                Users                 Join
Teens              200/400               click here
Over 25           134/400               click here
Over 30            350/400              click here
Singles             400/400                   full
College             200/400               click here

Total users online: 1284

Now how do I send this info to a page called client.php on my server then echo certian parts to the index page of my website.
It should try and not cause to much strain on my server.
966Asked:
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.

jet-blackCommented:
You can use XML or database to transfer data between them.
0
Mahdi78Commented:
That depend if you know PHP, then you can use TWebBrowser or Indy TIDHttp component
0
966Author Commented:
I am not great with php but I can learn what is needed.
Where can I read up on this type of idea/
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

966Author Commented:
yeh but remember  sending info to PHP rather than me extracting from sql is better as for example 300 concurrent users signing in then me trying to pull that would cause server problems.
So yes, sending info to php rather that php asking is good!
0
966Author Commented:
i should confirm I am only wanting to show users connected total and how many in each room, not the abilty to join, that was just example of my chatclient.
0
Mahdi78Commented:
I will display what i mean with the following example, we need Delphi client application and PHP server, we will send Username and Password from Client Delphi application to Server PHP script, then PHP server will show the following echo

Your Username: My usernameYour password: My password

PHP server

send.php

<?
  echo '<b>Your username:</b>'.$_POST['user_name']
.'  <br><b>Your password:</b> '. $_POST['password'];
?>

Delphi Client

uses IdMultipartFormData;

procedure TForm1.Button1Click(Sender:  TObject);
var data: TIdMultiPartFormDataStream;
begin
data  := TIdMultiPartFormDataStream.Create;
 try
   data.AddFormField('user_name', Edit1.Text);
   data.AddFormField('password', Edit2.Text);
  Memo1.Text  :=IdHTTP1.Post('http://localhost/post.php', data);
 finally
 data.Free;
 end;

end;

Edit1 with contain username Edit2 for Password


0
Mahdi78Commented:
Rename  PHP server file to post.php,
Delphi Client will send username and password to PHP server (post.php), then PHP server with display our data
0

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
966Author Commented:
I can read the sql with delphi but I dont wish to show delphi username and password.
I only wish to show total amount of logged in users on my application.
total user logged in:

total users logged in teens lobby:
total users logged in over25 lobby:

ect...

I guess its just counting and not showing exact username as they have already been accepted by delphi and allowed to this section>?
0
Mahdi78Commented:
do you tried my example?
I was displaying how do you send data from your Delphi client to PHP server (This is important step) other data movement is easy,
I need to you clarify what you want step by step

Remember movement data from User to MySQL database will be
User (Delphi Client) -------->  PHP Server -------> MySQL Database

Movement data from MySQL database to User will be
 MySQL Database -------->  PHP Server -------> User (Delphi Client)

0
966Author Commented:
hi will try now,  what tab are the components that I need?  thanks
0
966Author Commented:
i have the IDhttp

but where is TIdMultiPartFormDataStream ?
0
Mahdi78Commented:
TIdMultiPartFormDataStream is type of stream will call from IdMultipartFormData unit
0
966Author Commented:
i dont have that unit, in indy. evrything else is fine
0
966Author Commented:
ill load delphi 7, 1 min
0
Mahdi78Commented:
do you got error when put IdMultipartFormData in uses clause?
0
966Author Commented:
i cant find that multipartformdata in indi delphi 7 or 6, and yes I get error when its not there.
0
966Author Commented:
ah got it compiled but sent nothing back to web browser, post.php  where i pasted the code :
getting socket error 10061 connection refused on client



<?
 echo '<b>Your username:</b>'.$_POST['user_name']
.'  <br><b>Your password:</b> '. $_POST['password'];
?>

Open in new window

0
Mahdi78Commented:
It is 1:10 AM
put post.php in URL http://localhost/post.php and send data with indy with  
Memo1.Text  :=IdHTTP1.Post('http://localhost/post.php', data);

URL must be identical

Check this question
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_25336773.html
0
966Author Commented:
update:  I can now pull in that info from post.php into delphi client, but how do i do it the other way around client > php page?
0
966Author Commented:
yes late here to in England having an all night session :)  
Thanks for the help I now know how to send info to be viewed by all users to the client, excellent!

but now how to send counted users on my chat back to show on .php file ?
0
966Author Commented:
i do not believe the need to have sql involved as I am just echo info from delphi to php.

for example if 100 users are logged in on my delphi client and on the delphi chatroom then I wish to send info back to a php file saying hey we got 100 users in room: singles chat 100/300  come join us ect...     echo numbers back from delphi to php
0
Mahdi78Commented:
I think i answered 100% to your title question and 60% to your global question,
If you feel to you need help, i will help you from your delphi application, PHP server to MySQL database ;)
Remember, your database structure (Tables, Fields...) and global chat room mechanism is important
0
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
PHP

From novice to tech pro — start learning today.