scarr Posted August 3, 2012 Share Posted August 3, 2012 Hi all, Here is what I have 1) Webpage designed in "Xara web designer" with graphics etc and a lot of code in (produced by Xara) 2) A VB app listening to port 3456 when something arrives I can then do something like create a file or whatever. When for instance the Text "ON" arrives at the VB app, I want to update the webpage to have the word "ON" embedded in it. Now I am happy to dump the VB app if there is a better way of doing this so please please please help me as I have tried and not got anywhere Thanks Steve P.S. Cannot really get the VB to re-write the entire web page as there is loads in it and its all produced by Xara normally. Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/ Share on other sites More sharing options...
Maq Posted August 3, 2012 Share Posted August 3, 2012 I don't understand what you are asking. Do you want to know if you should rewrite your app in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1366613 Share on other sites More sharing options...
hakimserwa Posted August 3, 2012 Share Posted August 3, 2012 the text that is arriving where is it coming from? forms email? please explain you question nicer so we can understand Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1366617 Share on other sites More sharing options...
scarr Posted August 4, 2012 Author Share Posted August 4, 2012 Thanks for your replies and sorry for not explaining well, All I want to do is change text in a webpage based on text arriving on a TCP/IP port. When I started this the way I knew how to get data from client to my webserver was via TCP/IP port so I wrote a winsock VB, now I need to get this text into my webpage. I am more than happy to change how this data gets to the webpage (in other words do not use VB app) but if I do I will be totally out of my depth as I no very little about web programming. Having said that PHPH does look readable to me. Steve Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1366820 Share on other sites More sharing options...
gizmola Posted August 4, 2012 Share Posted August 4, 2012 More information on what is being sent to the VB application would be helpful. Also, what is the Xara authored page? Is it static html? PHP is very well suited to a task like this because you can freely intermix HTML and php in a php script. So I would suggest you assume you'll use PHP, and start by moving your entire .html page into a PHP script exactly as is. You can then have something like this: The status of the System is: You can easily drop in and out of php blocks in this manner. PHP will start with the assumption it is parsing HTML until it sees a php start tag. You are then simply left with the task of updating the status. To limit complexity, I would suggest you ditch the vb program, and just write a simple php script that your agent can make a simple get or put to. Something like this: //updatestatus.php if (isset($_GET['status']) { $status = $_GET['status']; // Do something to persist status } If your client can make an http GET request, you are 90% of the way there. Without knowing more about the possibilities of the client process that provides the update information, it's hard to advise you. At that point you have a variety of options for how to persist your status. The script could write the status to a file, or to a simplexml db, or any of numerous other options. One really simple "2 birds with one stone" option would be to design the code to set a key in APC cache, and have your display script get the key from there. You would simply have to supply a default in case the key doesn't exist. If these updates will be relatively frequently APC could be a really good option, as it's an in-memory cache, that also provides php opcode caching of the scripts themselves. APC is very simple to install usually, as long as you have pecl, however, I have limited experience with windows servers, and getting apc going. You can read more about it here: http://php.net/manual/en/book.apc.php Regardless of what you ultimately decide, PHP should get you up and running in minimal time. Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1366829 Share on other sites More sharing options...
scarr Posted August 5, 2012 Author Share Posted August 5, 2012 OK here is more info, I have a GSM module that can send info over a TCP/IP connection to a port on my PC, when I send data it appears as plain text in my vb app that is listening, e.g. "ON" or "OFF" or anything I want to send, I want to update my web page with this received text, so for instance in the middle of the blank page the word "ON" or "OFF" appears to anybody logging on to my page. So its not like a client session variable (forgive my wording but its the best I can do) its more like a global server variable hope this help as I am not getting anywhere with this. Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1366949 Share on other sites More sharing options...
Christian F. Posted August 6, 2012 Share Posted August 6, 2012 You can use PHP to listen to a port, using PHP sockets. Then do what gizmola recommended for making the status persistent. If you, for example, wrote it to a file ("status.inc") then you could use this simple line to print it out on the web page. <?php echo htmlspecialchars (file_get_contents ('status'.inc)); ?> Nice, simple and secure. Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1367268 Share on other sites More sharing options...
scarr Posted August 6, 2012 Author Share Posted August 6, 2012 OK going with plan to use PHP to do what I want but HELL php is not easy to install! I followed these instructions at http://www.iisadmin.co.uk/?p=4&page=2 and quickly ground to a halt, I did everything up to point of adding path for "php5isapi.dll", this was not there!!! so after trying to understand things, went and downloaded PECL collection for PHP 5.2.5 (as this was latest version I could get) and extracted this to c:\php still no php5isapi.dll file. At this point I thought it best to come here and ask!! Please help IIS6+Server 2003 Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1367295 Share on other sites More sharing options...
Christian F. Posted August 7, 2012 Share Posted August 7, 2012 That guide is over 5 years old, and as such is woefully out of date. I recommend using the PHP manual's installation guide, as it is up to date and should contain everything you need to know. Next time, I recommend looking at the date of the guide before following it. Quote Link to comment https://forums.phpfreaks.com/topic/266644-total-newbie/#findComment-1367421 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.