I have a site that will read XML post with the php://input under root directory but will not under a sub directory.
I can tell by the empty request xml file it generates in the sub directory.
<?php
$post = trim(file_get_contents('php://input'));
$timeStamp = date("Y-m-d") . "T" . date( "H:i:sP" );
$xmlName = "setupRequest" . $timeStamp . ".xml";
$FileHandle = fopen( "xml/" . $xmlName, 'w' ) or die( "can't open file" );
fwrite( $FileHandle, $post );
fclose( $FileHandle );
?>
It has been tested on two different URLs one pointed at the root and the other pointed at the sub directory. We always get blank 'setupRequest' file from the sub directory.
What could be an issue with this code?
Here is .htaccess file:
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.reallighting.com [NC]
RewriteRule ^(.*)$ http\:\/\/reallighting\.com\/$1 [R=301,L]
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=AndyAdmin|ETCAdmin|RealAdmin
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^reallighting.com
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /homepages/37/d276009229/htdocs/WP/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN WPSuperCache
# END WPSuperCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress