Delphi communication application

Hello experts!
Please help me.

I have a website (hosting soft : ruby,php,perl).
I need to create a application that communicates with site. Sure, site may have a script or file.

Program must send requests to server.
For example : When the remote PC is up, and application running, it will send a request and server will understand that the host is up.
Can someone suggest me what kind of script or CMS or ruby app i need to install on site?
Please help.
helyonprime96Asked:
Who is Participating?
 
babbloConnect With a Mentor Commented:
Use the basic code below, just take care of sanitize $_GET['XXX'] variables before the insert.

Hope this help.
<?php
if (!empty($_GET)){
	$sql = 'INSERT INTO table_name (`status`, `host`) VALUES ("'.$_GET['status'].'", "'.$_GET['host'].'")';
	mysql_query($sql);
}
?>

Open in new window

0
 
babbloCommented:
Hello helyonprime96, you can send the information simply making a POST over a php file located at the server, or you can send a JSON, etc.

On client side (Delphi APP), try using Indy HTTP client to send the POST.

On server side (PHP) simply "catch" the information inside $_POST variable.

Tell me if you need something else.




0
 
jimyXCommented:
I have come through a similar requirement. You may have a look at this PAQ by Mahdi78 which shows a communication between Delphi and php:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_25734113.html
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

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).

 
helyonprime96Author Commented:
babblo:
hello and thanks for you suggestion.

i think so. can you help me to make a php file that listen posts from application.
application will post something like this : www.site.com/engine.php?status=up&host=.....

and i want that another file imports the stats from engine.php (for example)
help me,please
0
 
babbloCommented:
Please tell me where you want to save the received information. (DB? File?...)
0
 
helyonprime96Author Commented:
yes.
i have mysql db.
sorry for delay.
please help me with this php file.thanks
0
 
helyonprime96Author Commented:
ok. thanks
but i want to see results in a separated php file.
and tell me what is the link to post.
thanks
0
 
babbloConnect With a Mentor Commented:
Ok..

In your Delphi App, do a GET request to this: (the code I sended)

http://www.yourdomain.com/log.php?host=XXXX&status=YY

Where:

XXXX = A string variable with the host name
YY = A string variable with the status (UP / DOWN)

Then, to see the "log", create a new file with this code:




<?php
$sql = 'SELECT * FROM table_name';
$res = mysql_query($sql);
if ($row = mysql_fetch_assoc($res)){
  do{
    echo 'Host: '.$row['host'].' <br/>';
    echo 'Status: '.$row['status'].' <br/><br/>';
  }while($row = mysql_fetch_assoc($res));
}else{
  echo 'Nothing yet...';
}

?>

Then, go to www.yourdomain.com/thefile.php and you are ready :)

Open in new window

0
 
babbloCommented:
Btw, if you need want more professional or with a better look, please tell me and I can send you a quote for the complete job.

Have a nice day!
0
 
helyonprime96Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.