Showing results for 
Search instead for 
Did you mean: 

$_POST fields lost with DPM when relay_url moved out of root directory

I am upgrading a legacy website (that uses old WebLink integration method with Auth.Net) to use the Direct Post Method so that I can populate an online database with the results of transactions.


I have created a test account, and downloaded the sample code, which uses a file named 'direct_post.php' for both the relay_url and the receipt page.  In the sample code, direct_post.php is located in the website's root directory.  When tested in this way, everything works perfectly.


I then took the next step, trying to move the 'direct_post.php' to the php folder in my directory structure.  In doing so, I changed x_relay_url in the POST to to point to the new location, updated the Relay Response URL in my test account, and tried again.  Authorize.Net's transaction response DOES make it to direct_post in the new location, but all $_POST variables are lost - so I am unable to process the transaction.


Below is the direct_post file as downloaded w/ sample - I've added code that immediately finds, and prints to a file, the size of the POST and GET arrays. 



require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$url = "";
//$url = "";
$api_login_id = 'myapilogin';
$transaction_key = 'mytransactionKey';
$md5_setting = 'myapilogin'; // Your MD5 Setting

$myString = "inside direct_post with POST count of ".count($_POST)." and count of GET of ". count($_GET)."";
					$fname = "debug_".time().".txt";
					$fp = fopen("$fname",'a');

AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>



 When direct_post resides in the root directory, the file that is created correctly shows:

     >>>>>  inside direct_post with POST count of 61 and count of GET of 0


When I move direct_post to lower in the directory structure, the file generated shows:

     >>>  inside direct_post with POST count of 0 and count of GET of 0


Any idea what could be happening?