Pass data1 Passing data from an HTML page to a program Dr Jim Briggs.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
HTTP By: Becky Fultz, Joe Flager, Katie Huston, Tom Packard, Allison Wilsey.
JavaScript Forms Form Validation Cookies CGI Programs.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
Pass data1 Passing data from an HTML page to a program Dr Jim Briggs.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Definitions, Definitions, Definitions Lead to Understanding.
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
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.
Rensselaer Polytechnic Institute CSC-432 – Operating Systems David Goldschmidt, Ph.D.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
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.
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.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Web forms in PHP Forms Recap  Way of allowing user interaction  Allows users to input data that can then be processed by a program / stored in a back-end.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
HyperText Transfer Protocol (HTTP).  HTTP is the protocol that supports communication between web browsers and web servers.  A “Web Server” is a HTTP.
Web application architecture
Copyright (c) 2010, Dr. Kuanchin Chen1 The Client-Server Architecture of the WWW Dr. Kuanchin Chen.
CP476 Internet Computing CGI1 CGI is a common way to provide for specific computations on server side, interactions with users, or access to databases.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
USING PERL FOR CGI PROGRAMMING
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
Website Development with PHP and MySQL Saving Data.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
Chapter 9: Perl and CGI Programming CGI Programming Acknowledgement: Some materials are taken from Teach Yourself CGI Programming with PERL 5 in a Week.
Chapter 6 Server-side Programming: Java Servlets
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
76 © 1998, 1999, 2000 David T. Gray, Howard Duncan, Jane Kernan Frames When displaying information in a browser, it is sometimes useful to divide the display.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
1 Seminar on Service Oriented Architecture Principles of REST.
Web Technologies Interactive Responsiveness Function Hypertext Web E-Publishing Simple Response Web Fill-in Forms Object Web « Full-Blown » Client/Server.
Form Data Encoding GET – URL encoded POST – URL encoded
Netprog 2002 CGI Programming1 CGI Programming CLIENT HTTP SERVER CGI Program http request http response setenv(), dup(), fork(), exec(),...
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
 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.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Overview of Servlets and JSP
Web Server Design Assignment #5: Unsafe Methods & CGI Due: 05/05/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
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.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
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.
HTTP – An overview.
CGI I: Basics Web Programming.
Introduction to CGI and ajax
Web Server Design Assignment #5: Unsafe Methods & CGI
Hypertext Transfer Protocol
Hypertext Transport Protocol
Introduction Web Environments
Representational State Transfer
HTTP Protocol.
WEB API.
Introduction to CGI and ajax
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
World Wide Web Components
PHP Forms and Databases.
HTTP Hypertext Transfer Protocol
CGI I: Basics Web Programming.
Presentation transcript:

Pass data1 Passing data from an HTML page to a program Dr Jim Briggs

Pass data2 Recap on HTTP/CGI architecture

Pass data3 An example HTML form

Passing data via HTTP: GET If the method is GET: data passed in the query string –Which would result in the request GET HTTP/1.1 –and in the location bar of the browser ay Pass data4

Passing data via HTTP: POST If the method is POST: data passed in the body of the message –Which would result in the request POST HTTP/ [headers] city=Portsmouth&day=today – and in the location bar of the browser Pass data5

6 HTTP encoding Queries –? separates path from query –& separates name/value pairs –= separates name and value Both –+ for space –%xx for special characters (e.g. %7E for ~)

Pass data7 HTTP methods Standard methods –OPTIONS –GET –HEAD –POST –PUT –DELETE –TRACE –CONNECT Extension methods Means of passing parameters: –GET passes parameters in query –POST passes parameters in body (or both) From a browser: –Links ( tags) result in GET actions –FORMS can use either GET or POST or another method

Pass data8 When to use which method? Use GET for actions: –that are safe –that are idempotent –where the total length of the URI is less than 256 chars –where it's OK for the parameters to be visible to the user –where it's OK for the parameters to be preserved as part of a bookmark Use POST for –everything else

Pass data9 "Safe" Implementors should be aware that the software represents the user in their interactions over the Internet, and should be careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves or others. In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. –These methods ought to be considered "safe". –This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested. Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. –The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.

Pass data10 "Idempotent" Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. –The methods GET, HEAD, PUT and DELETE share this property. –Also, the methods OPTIONS and TRACE SHOULD NOT have side effects, and so are inherently idempotent. However, it is possible that a sequence of several requests is non- idempotent, even if all of the methods executed in that sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always yields a result that is not changed by a re-execution of all, or part, of that sequence.) For example, a sequence is non-idempotent if its result depends on a value that is later modified in the same sequence. A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are being executed on the same set of resources).

Pass data11 Recap on HTTP/CGI architecture

Pass data12 Passing data via CGI Environment variables –REQUEST_METHOD –CONTENT_LENGTH –QUERY_STRING –REMOTE_HOST –REMOTE_USER Message body passed to stdin

Pass data13 An HTML form

Pass data14 Example program P/notes/general/mynameis1.pdfhttp://userweb.port.ac.uk/~briggsj/WEB P/notes/general/mynameis1.pdf