| |||||||||||
| |||||||||||
Adding PHP tags to an old cgi program
Our web site has grown over the years, and we've developed a number of very useful scripts such as our quotation system that's written in Perl and our live server test program in Tcl and Expect. Now we require to run those scripts within the current look and feel, with its printer friendly flexibility, customisation to reflect the country from whom our visitors arrive, and so on, all of which are facilities offered by PHP. This can't simply be done by adding PHP tags into the output of the Perl or Tcl programs - cgi output is NOT parsed by the PHP interpreter - so how have we done it?
* New PHP pages call up the cgi scripts, now using them as application servers, and extract the pertinant information they return. * Our cgi-bin scripts are little changed, but we have added markers in the form of HTML comments to indicate the start and end of the content generated. * In the case of CGI scripts which use form inputs, we have also updated the scripts so that they can read parameters from the command line in addition to URL-encoding. Try out our new server status page and see how it works. You can see the source code here and you can still run it the old way here (Shhh - don't tell the look-and-feel team). The extra code in the PHP page is just: $howsit = implode("",file("http://$_SERVER[SERVER_NAME]/cgi-bin/net/livetest.exp")); preg_match('/<!-- start -->(.*)<!-- end -->/is',$howsit,$gotten); (written 2006-04-08 07:43:56) Associated topics are indexed under H112 - PHP - Further Web Page and Network HandlingT212 - Tcl/Tk - Expect Processes
Some other Articles
More or less on the edge of the pageWhy are maps rarely to scale? Sympathetic development Melksham, Wiltshire Adding PHP tags to an old cgi program Wiltshire to get an extra MP Helicopter views and tartans Keeping your regular expressions simple Both ends of the animal Architectural Heritage - Devizes 1635 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||