cancel
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 Auth.net 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. 

 

Direct_post.php:

<?php
require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$url = "http://www.myweb.com/direct_post.php";
//$url = "http://www.myweb.com/websitePages/php/direct_post.php";
$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');
					fwrite($fp,$myString);
					fclose($fp);

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

 

 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? 

dstocks
Member
0 REPLIES 0