I have two files in the same dir: test.html and test.php, served by IIS 5.0. I can use my browser (Opera and IE) to view both of these files (http://localhost/EARN/test.htm, or http://localhost/EARN/test.php). They both look fine in both browsers.
In another dir I have a .php file I execute from the command line. It does an HTTP GET on these two files. Here's my problem. My CLI file gets what I expect from IIS when I try to GET test.htm. When I try to GET test.php, though, I get the HTTP headers, then nothing! IIS is set up to understand php (otherwise my browser wouldn't see test.php appropriately). What am I missing? Thanks.
Here's the CLI program:
<?php
$server = "localhost";
$url = "/earn/test.php";
$port = 80;
// open socket
$fp = fsockopen($server, $port);
if (!$fp) {
echo "Could not open socket";
}
else {
$getData = "GET $url HTTP/1.0\r\n";
$getData .= "User-Agent: PHP-MJF Client\r\n";
$getData .= "\r\n";
fwrite ($fp, $getData);
$getResponse = fread ($fp, 14096);
fclose ($fp);
echo $getResponse;
echo "\n\nDone\n";
}
?>
Here's test.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
echo "Helloooo, world!" ?>
</body>
</html>
=================
Here's test.htm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
Hello!
</body>
</html>
Output when I try to GET test.php:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 03 Nov 2003 23:51:27 GMT
Content-type: text/html
X-Powered-By: PHP/4.3.3
===================
Output when I try to GET test.htm:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 03 Nov 2003 23:53:22 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Mon, 03 Nov 2003 23:11:21 GMT
ETag: "c051b0cb5fa2c31:974"
Content-Length: 156
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
Hello!
</body>
</html>