CS 1704 Introduction to Data Structures and Software Engineering.

Slides:



Advertisements
Similar presentations
Adding Dynamic Content to your Web Site
Advertisements

Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Common Gateway Interface (CGI). CGI is a protocol: CGI is not a programming language CGI is a protocol for the exchange of information between between.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
A simple PHP application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the application returns.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ15A - The Internet Programming Language Design and.
1 Static Web Pages Websites on Servers (The Big Picture) –Apache Tomcat can support static web pages –Primarily intended to support servlets and JSP –Some.
CS 898N – Advanced World Wide Web Technologies Lecture 6: PERL and CGI Chin-Chih Chang
Python and Web Programming
Simple PHP application. A simple application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the.
Python Web Applications A KISS Introduction. Web Applications with Python Fetching, parsing, text processing Database client – mySQL, etc., for building.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Web Client/Server Communication A290/A590, Fall /09/2014.
ITIS 1210 Introduction to Web-Based Information Systems Chapter 41 How Animation on the Web Works.
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
LING 408/508: Programming for Linguists Lecture 17 October 21 st.
ITIS 1210 Introduction to Web-Based Information Systems Chapter 24 How Websites Work with Databases How Websites Work with Databases.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
CSE 305 Theory of Database Tutorial on Connecting with Sybase from Java program and Developing GUI Jalal Mahmud, TA, CSE 305.
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
Python CGI programming
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
USING PERL FOR CGI PROGRAMMING
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Java Servlets example using NetBeans 6. Pre-requirements: Install Java JDK 1.6 Install NetBeans IDE 6 (we will use version NetBeans IDE update 16)
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
1 Web-Based XML File Repository CS360 Project # Dongjoon Hyun.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) Instructor: Joseph DiVerdi,
SIR and the WEB By Dave Doulton University of Southampton.
Introduction to JavaScript CS101 Introduction to Computing.
Netprog 2002 CGI Programming1 CGI Programming CLIENT HTTP SERVER CGI Program http request http response setenv(), dup(), fork(), exec(),...
Google Application Engine Introduction Jim Eng with thanks to Charles Severance
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Chapter 16 Web Pages And CGI Scripts Department of Biomedical Informatics University of Pittsburgh School of Medicine
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
1 The Internet Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
Section 10.1 Define scripting
Topic 2: Hardware and Software
CGI programming Using Apache.
Introduction to Dynamic Web Programming
CGI I: Basics Web Programming.
Section 17.1 Section 17.2 Add an audio file using HTML
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
PHP Introduction.
CGI programming Using Apache.
MIS 3200 – Unit 6.1 Moving between pages by redirecting
Introduction to JavaScript
CGI I: Basics Web Programming.
Presentation transcript:

CS 1704 Introduction to Data Structures and Software Engineering

Project 4.2 Help Read D+D chapter 6 on web programming with CGI –Parameters –Environment Variables –HTML (including Forms)

How to make C++ CGI Very first thing output must be: –cout <<"Content-Type: text/html\n\n"; –cout "; The very last line should be: –cout "; These allow the webserver to know that you are outputting html (web) content. Afterwards, just use cout to output everything you used to print to output.data, using a " " instead of every endl; Rename your executable.cgi (instead of.exe)

How to view CGI Install Apache HTTP server on your home machine ( (The download page is and you want the file Win32 Binary (MSI Installer): apache_ win32-x86- no_ssl.msiwww.apache.orghttp://httpd.apache.org/download.cgi To test your implementation, put it and all your input files into the cgi-bin directory that Apache created. Then open a web browser and run by typing bin/yourexecutable.cgihttp://localhost/cgi- bin/yourexecutable.cgi

Parameters for navigation Links in html: – Quit However, to pass variables from one page to the next, you want the linke to look like: – Quit Looks like: Quit menuItem is a variable value of variable

How could you print that? Create some strings –string a = “<a href=\“”; –string ref= “ –string b = “\“>”; –string c = “ ”; Then use cout –cout << a << ref << b << “Quit” << c;

Getting Parameters #include There is a system variable called QUERY_STRING that has string parameters =getenv(“QUERY_STRING”); //could be: menuItem=quit //could be: m1=x&m2=y&m3=z Then parse parameters string to get commands! –(Anyone may post a parser to the forum) Must cite if you use and were not the author

Using that parameter Use a function/parser to get the values of the parameters string link=getValue(parameters, “menuItem”); –//link will have the value “quit” Then do if statements: –if (link == “quit”) { //code here} –else if (link == “addstudent”) {//code here} –… NOTE: Your program completely runs once per interaction with the user! It completely exists each time it has printed…the quit command may just print out “goodby” for example.

Getting Data from users: HTML Forms See the name=“word”? Whatever is typed into the textbox goes into a parameter variable named word!

What it (kinda) looks like. When you push the submit button, it does a: yourpid.cgi?word=whateveryoutypedin Submit Word Text box Button

Getting the word string p=getenv(“QUERY_STRING”); say user had typed “Parrot” p will be: “word=Parrot” Just parse to get what is after “word=“ You can have more than one textbox However, this will make p look like: “word=parrot&x=y&m=z”

Rules for this project A parse method/function can be shared on the forum Any html is free to be shared on the forum Nothing else can be shared!!!

Demos +20 point bonus: April 26th, point bonus: April 28th, point bonus: April 30th, point penalty: May 3rd, point penalty: May 5th, point penalty thereafter.