Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development | Spring 2019

## Web Program Examples

Markup or content is embedded within a program; program embedded into markup

### first.pl - Perl

first.pl

    #!/usr/local/bin/perl
    print "Content-type: text/html\n\n";
    print "<html><body><h1>Hello, World!</h1></body></html>";

### first.py - Python

first.py

    #!/usr/bin/python
    print "Content-type: text/html\n\n";
    print "<html><head><title>Hello World!</title></head>";
    print "<body><h1>Hello, World!</h1></body></html>";

### first.php - PHP

first.php

    <?php
    echo('<html><head><title>First PHP</title></head><body>');
    echo('<h1>Hello!</h1>');
    echo('</body></html>');
    ?>

### second.php - PHP

second.php
program statements within markup

    <?php
          $title = "Hello World!";
    ?>
    <!DOCTYPE html>
      <head>
        <meta charset="utf-8" />
        <title><?php echo($title) ?></title>
      </head>
      <body>
        <h1><?php echo($title) ?></h1>
      </body>
    </html>

Copyright © David Heitmeyer