I would like to make a php script output like a real 404 page (as set in the Apache ErrorDocument directive) if certain conditions are not met. I'm not sure how I can / if it's possible to access this value from PHP..
if(!@$_SESSION['value']){
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
echo $default_page['404'];
exit();
}
echo 'Welcome to a secret place.';
I understand the ErrorDocument value can be overwritten, but I'm particularly interested in the 'default' value hardcoded by Apache. If it's possible to know the value which is overwitten (eg by a .htaccess file), then that's a bonus :)
http://httpd.apache.org/docs/2.0/mod/core.html#ErrorDocument
edit: to be clear, I'd like to send the content the default 404 page (or 403, etc) of Apache from PHP. If I only use header on its own then nothing is output to the client/user (at least in FF/Chrome, IE has its own built in pages which are shown).
ErrorDocumentset at all. Not sure whether this is possiblecurlmay already be built into the version of PHP your host is using. Try creating a filephpinfo.phpcontaining just<?php Header('Content-type: text/html'); phpinfo(); ?>, then navigate to that page and see if Curl is listed.