Introduction to CGI and ajax

Slides:



Advertisements
Similar presentations
1 CGICGI Common Gateway Interface Server-side Programming Lecture.
Advertisements

Video, audio, embed, iframe, HTML Form
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Web Database Programming Input Validation. User Input on the Web Web browser built-in mechanisms –HTML Forms HTTP POST method –Hyperlinks HTTP GET method.
JavaScript Forms Form Validation Cookies CGI Programs.
IS 360 Course Introduction. Slide 2 What you will Learn (1) The role of Web servers and clients How to create HTML, XHTML, and HTML 5 pages suitable for.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
How the web works: HTTP and CGI explained
Multiple Tiers in Action
Introduction to Web Based Application. Web-based application TCP/IP (HTTP) protocol Using WWW technology & software Distributed environment.
And so on CGI programming Web Services Java Programs for the Web.
Apache Tomcat Server Typical html Request/Response cycle
Contrast with JavaScript HTML Formsto invoke Java Server Pages Structure of Forms Query strings Java Server Pages Sent From Browser To Serverfor JSP.
Lecture 13 Dynamic Web Servers & Common Gateway Interface CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
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.
Emlékeztető December 1.-én pótoljuk az elmaradt előadást (nov. 24-ről) az A/1 228-as teremben ig December 8.-án tartjuk a pótZH-t a sikertelen ZH-t.
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.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
INTRODUCTION TO WEB DATABASE PROGRAMMING
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 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
USING PERL FOR CGI PROGRAMMING
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
JavaScript – Quiz #9 Lecture Code:
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Website Development with PHP and MySQL Saving Data.
Architecture of the web Client Server retrieved or generated web page.
CGI Programming. What is it? CGI –Common Gateway Interface Standard way to pass information back to the Web Server –GET Query String –POST Standard Input.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Approaches for creating dynamic web pages Server-side processing: Server receives a request, performs all processing necessary to create a dynamic web.
Web Architecture Introduction
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Netprog 2002 CGI Programming1 CGI Programming CLIENT HTTP SERVER CGI Program http request http response setenv(), dup(), fork(), exec(),...
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Web Technologies Lecture 8 Server side web. Client Side vs. Server Side Web Client-side code executes on the end-user's computer, usually within a web.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
JavaScript and Ajax (Internet Background) Week 1 Web site:
It’s World Wide! I NTRODUCTION TO T HE WEB 1 Photo courtesy:
Pass data1 Passing data from an HTML page to a program Dr Jim Briggs.
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.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
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)
National College of Science & Information Technology.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
JavaScript and Ajax (Ajax Tutorial)
CS 330 Class 7 Comments on Exam Programming plan for today:
Section 6.3 Server-side Scripting
Web Development Web Servers.
How to Write Web Forms By Mimi Opkins.
PHP / MySQL Introduction
Introduction to CGI and ajax
IS 360 Course Introduction
Web Browser server client 3-Tier Architecture Apache web server PHP
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
World Wide Web Components
Architecture of the web
An Example of a TCP/IP Application: the World Wide Web
Web Server Design Week 16 Old Dominion University
Client-Server Model: Requesting a Web Page
Presentation transcript:

Introduction to CGI and ajax SCMP 391.00 Special Topic: Software Development Spring 2017 James Skon

Web Applications Client/Server applications Client: browser Server: web server Client submits request Server processes client’s request Server responds Client process and display server’s response

Server‐Side Applications Processing is done at the server Server responds with HTML code Client only renders HTML code Example: CGI (PHP, ASP.net, Perl, CodeFusion)

Client‐Side Applications Processing is done at the client Server sends code to be executed on client Examples: JavaScript, CSS, Java applets, Flash

Hybrid Applications Not pure client side or server side Most web applications combine both Server side for data processing Client side for interactive user interface

Common Gateway Interface (CGI) Standard interface between external applications and web servers Web server execute CGI program in real time set some environment variables execute program (fork, exec) redirect sdtin to program, stdout to browser

Common Gateway Interface (CGI)

CGI Environment Variables REQUEST_METHOD GET: data is sent as part of URL POST: data sent in stdin QUERY_STRING list of variable names and their values CONTENT_LENGTH length of data in bytes (for POST method)

Request Method: GET

URL Encoding Variables are separated by “&” Alphanumeric characters not encoded Most non‐alphanumeric encoded as %XX XX is the hex ASCII value of character Space: encoded as “+” e.g. data = “Salam Alykom!” form.cgi?data=Salam+Alykom%21 “=” is encoded as “%3D” “+” is encoded as “%2B”

Request Method: POST POST /cgi‐bin/post1.cgi HTTP/1.1 Data (query string) is sent to stdin Data is encoded using same URL encoding CONTENT_LENGTH set to byte length of data

US Census Names AJAX Demo /home/class/SoftDev/namesclientserver Apache cslab.kenyon.edu bibleajax.html cslab.kenyon.edu/ class/softdev/skon/name_stats_ajax.html Bibleajax.cgi

Web Request Last name to look up data for: <INPUT NAME="name" TYPE="text" id=name MAXLENGTH=30></TD> <p> <input type="button" onclick="javascript: getresponse ()" name="submit" value="Submit" />

Web Request function getresponse () { var ts = getCheckedValue(document.radioResultsSelect.type_select); var name = document.getElementById('name').value; if (name.length < 1) return; XMLHttp.open("GET", "/cgi-bin/skon_namefetchajax.cgi?" + "&type_select=" + ts + "&name=" + name,true); XMLHttp.onreadystatechange=function() { var table = nameTable(XMLHttp.responseText); document.getElementById('response_area').innerHTML = table; } XMLHttp.send(null); }