==================================================================== PowerBASIC Gazette - Electronic Edition Volume 1 - Issue 6 PowerBASIC, Inc. (888) 659-8000 Sales 2061 Englewood Road (941) 473-7300 Voice Englewood, FL 34223 (941) 681-3100 Fax Visit us on the World Wide Web at http://www.powerbasic.com Email Sales: sales@powerbasic.com This newsletter is only sent to email addresses in our subscription list. If you have received this newsletter by mistake or no longer wish to receive it, please send a simple unsubscribe request to support@powerbasic.com with your name and zip/postal code. This newsletter is best viewed with a fixed-width font. ==================================================================== What's Inside this Issue? - Creating Dynamic Web Pages with PB/CC - New telephone area code for PowerBASIC - Subscription information for the PowerBASIC Gazette ==================================================================== Creating Dynamic Web Pages with PB/CC ------------------------------------- by Dave Navarro - PowerBASIC Inc. As we near the next millennium , it is becoming apparent that more than 50% of all interaction between customers and hi-tech companies will be handled on the internet. For BASIC programmers there's been no clear path of migration to the internet. Or at least, there wasn't until now. For the first time, BASIC programmers can write applications for their web servers with out any kind of kludge or third-party interface. The PowerBASIC Console Compiler for Windows has direct support for 32-bit STDIN and STDOUT. This means your web server communicates directly with your application and your application communicates directly with your web server. Allowing remote users or staff members to access your company's data via the World Wide Web has never been easier. What is CGI? CGI stands for Common Gateway Interface, the actual method used by a web server to "talk" with a CGI program. When a web server executes a CGI program, it captures all data sent to and from "standard I/O". Using the STDIN keyword in PB/CC you can read the data sent to your program from a web browser form or document. You can then parse through the data, perform some kind of action (a database lookup?) and then use the STDOUT keyword to send data back to the browser. Typically, you would do this using the HTML language to make it look nice and pretty. Is that all there is? Of course, writing a complete CGI program takes a little more than just reading and writing data through standard I/O. When your program reads data from a web browser form, it is sent in a format called "URL encoding". That means certain characters which can not be sent over the internet (such as a tilde ~) are encoded into a special hex format that can be transmitted over the internet. After the input data from the web server has been decoded, you can access the information from the different fields in your form. Each field in your form has a "name" associated with it. And the data for that field has a "value". Together, they are called "name/value pairs". For example, you may have a field name called "firstname" and a value associated with it of "denise". The web server will give them to you in the form of "firstname=denise". Once you have decoded the data into something you can manage and you are ready to begin talking back to the web browser, you must first tell the web server what type of data you are going to send it. This is done by using the STDOUT statement to print a header. The most typical header is for HTML, so we would print "Content-type: text/html" followed by a couple of carriage return / linefeed pairs. You can then begin sending your HTML code for the rest of the page. Because web servers can run on so many different platforms (Linux, for example), there are actually several different methods for exchanging data between a web server and a CGI application. The method described above is called the POST method, and is the most common. All known Windows 95/98/NT web servers support the POST, GET and COMMAND methods. PB/CC includes the complete source code to a CGI application and an HTML page with a form that you can test with your web server. It's important to note that you can not call a CGI application directly from a browser, you must call it from an HTML page on your web server. Microsoft provides the Personal Web Server (called Peer Web Server on Windows NT) with Microsoft Windows. In addition to the example code, PB/CC includes the code necessary to support all of the CGI communications methods, handle URL decoding, and parsing your name/value pairs into an array that you can more easily access. See the PBCGI.INC file for more details. For more information on CGI programming, please visit the site http://hoohoo.ncsa.uiuc.edu/cgi/ where you'll find the latest news. You can find even more information on HTML and creating forms at www.w3.org, the standards body of the World Wide Web. The PowerBASIC Console Compiler for Windows (PB/CC) is priced at $149 plus shipping. To order PB/CC, or any PowerBASIC product, call us today at (888) 659-8000 or (941) 473-7300. You can Fax your order to (941) 681-3100. Place an electronic order on our World Wide Web Site (www.powerbasic.com), or even mail it in. But whatever method you choose, please do it today, and do it with confidence. Every PowerBASIC product is offered with a money back guarantee for 30 days from the invoice date. ==================================================================== Order online at https://www.powerbasic.com/shop/ ==================================================================== Is your PowerBASIC Gazette Electronic Edition subscription coming to you at home or work? If you don't want to miss a single issue, why not subscribe from both email addresses? Send your subscription request to email@powerbasic.com and please include your name and all email addresses you'd like to add as well as your Zip or Postal Code. If you know someone else who would enjoy this newsletter please forward a copy to them so they can subscribe. ==================================================================== All contents Copyright (c) 1998-2009 PowerBASIC, Inc. All Rights Reserved. PowerBASIC is a registered trademark of PowerBASIC, Inc. PB/CC, PB/DLL, and PowerTREE are trademarks of PowerBASIC, Inc. All other brand names are trademarks or registered trademarks of their respective owners. ====================================================================