Click here to Skip to main content
11,930,231 members (46,420 online)
Rate this:
Please Sign up or sign in to vote.
See more: PHP web-dev

As the subject says I want to write web app that communicates with the client in PHP which I started to work with not so long ago. I have a network device controlling my heating at home and its connected to internet with dynamic ip, and I want to connect it to server where there will be an application which shows the temperatures or any string that the device is sending, also to be able to send back some command which tells the device what to do. In simple words I need to send and receive strings between the application and the network device. The embedded programing would be in C, and I need to define the best way for the communication.

Edit: After googleing about this for few hours I stumbled into PHP socket functions. Can this be done using them?
Posted 6-Nov-12 7:50am
Edited 7-Nov-12 12:14pm
Your own heating control? Wow!
Why strings? should better be binary, if possible.
The only problem I see is your Internet Server Provider (ISP). For regular residential service, they usually won't allow you to provide any service from your home, and this is what you would really need. So, how about that?
RateP 7-Nov-12 17:11pm
Why strings? Honestly I don't know, I'm not programing the device, and I'm told that the app should capture and return strings, and I need to provide and decide how the server and the client will communicate.
Sebastiaan Meijerink 6-Nov-12 17:25pm
You could host the webapp from a home computer. Poke a hole in your router. That way you only have to deal with a local area network. You could use xamp for the php server. Talking to the c software from php shouldn t be a problem that way.
RateP 7-Nov-12 17:07pm
The idea is to control or view the device outside LAN
Sebastiaan Meijerink 8-Nov-12 2:12am
That doesnt mean the webserver itself couldnt be in the lan. You can host the website to the internet from your own home.
RateP 8-Nov-12 11:27am
Yes, that would be good solution of the problem, but in future I plan to have more users and more devices, and also already purchased web hosting and domain so...Anyway thank you for the feedback.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Of course it can. Sockets are the best way to communicate bytes between applications. You need a Server(Listener) and a client(Sender). Is this setup going to need more than one client sending strings to the server to get it to do stuff?...You should probably look into if you want to do this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 7 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100