Click to See Complete Forum and Search --> : php code in html page -problem


Taurus
03-21-2003, 11:47 AM
I put the php code on html page in FrontPage 2000 as follows:

<?php
$file_url = "http://www.domain.abc/folder/file.pdf";
header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename="file.pdf"");
header("Location: $file_url");
?>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

</body>

</html>

When I place page on web server, I receive error message like:

Warning: Cannot add header information - headers already sent by (output started at /host/h/e/l/p/o/r/domain.abc.com/index.php:7)
in /host/h/e/l/p/o/r/domain.abc.com/index.php on line 9

Warning: Cannot add header information - headers already sent by (output started at /host/h/e/l/p/o/r/domain.abc.com/index.php:7)
in /host/h/e/l/p/o/r/domain.abc.com/index.php on line 10

and so on..


Where do need put the code in this case? Is the basic HTML code that FP begins a new web page unnecessary?

pyro
03-21-2003, 11:53 AM
Seeing how you are doing a PHP redirect before any of the actual html content will be displayed, just remove all of it from your page... It should however be working. Are you sure there is no html before the PHP code?

Taurus
03-21-2003, 12:40 PM
I remove all content from html window and paste the php code at the top. But now I get error:ERROR 404 PAGE NOT FOUND

Taurus

pyro
03-21-2003, 12:44 PM
Does this exist?

$file_url = "http://www.domain.abc/folder/file.pdf";

Taurus
03-21-2003, 12:53 PM
This is sample, the http://www.domain.abc/folder/ exist normally,
but http://www.domain.abc/folder/file.pdf - gives error:ERROR 404 PAGE NOT FOUND