Jump to content

Total newbie!!!


scarr

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.