grade;
// If we have a POST, pass to the GET
if ( count($_POST) > 0 ) {
$_SESSION['postdata'] = $_POST;
$count = 0;
$good = 0;
foreach($headers as $key => $val ) {
if ( ! in_array($key,$fields) ) continue;
$postkey = mapdown($key);
$count++;
if ( isset($_POST[$postkey])&& mapdown($_POST[$postkey]) == mapdown($val) ) {
$good++;
}
}
if ( $count == 0 ) {
die("No expected fields found");
}
$gradetosend = (1.0 * $good) / $count;
LTIX::gradeSendDueDate($gradetosend, $oldgrade, $dueDate);
header('Location: '.addSession('index.php'));
return;
}
if ( $RESULT->grade > 0 ) {
echo('Your current grade on this assignment is: '.($RESULT->grade*100.0).'%
'."\n");
}
if ( $dueDate->message ) {
echo(''.$dueDate->message.'
'."\n");
}
$postdata = isset($_SESSION['postdata']) ? $_SESSION['postdata'] : array();
unset($_SESSION['postdata']);
?>
Exploring the HyperText Transport Protocol
You are to retrieve the following document using the HTTP protocol in a way
that you can examine the HTTP Response headers.
There are three ways that you might retrieve this web page and look at the response headers:
- Preferred: Modify the socket1.py
program to retrieve the above URL and print out the headers and data.
Make sure to change the code to retrieve the above URL - the values are
different for each URL.
- Open the URL in a web browser with a developer console or FireBug and manually examine the headers that
are returned.
- Use the telnet program as shown in lecture to retrieve the headers and content.
Enter the header values in each of the fields below and press "Submit".
instructor ) {
echo("\n
");
echo("\n\n");
echo("Retrieved information:\n");
print_r($headers);
echo("\n");
echo($data);
echo("\n\n");
}