WordPress Process $ _POST Inside Analysis Request
I am writing an application to receive and process an instant payment alert message in Wordpress. This is a POST request made for a "virtual" URL with rewrite rules. However, the problem is that only GET vars are available, I cannot access the post variable:
And:
Result in an empty arrayprint_r($wp->query_vars['ccustfirstname']);
print_r($_POST);
I modified the existing code to fit my case:
function ao_add_rewrite_rule() {
print_r($_REQUEST);
$ipn_parameters=array("ccustfullname","ccustfirstname", ... );
foreach ($ipn_parameters as $key => $value) {
add_rewrite_tag("%$value%",".");
}
add_rewrite_tag("%arevico_api%",".","");
add_rewrite_rule( 'ipn', 'index.php?&arevico_api=ipn', 'top');
add_rewrite_rule( 'hoplink', 'index.php?&arevico_api=hop', 'top');
add_rewrite_rule( 'pay', 'index.php?&arevico_api=pay', 'top');
flush_rewrite_rules();//TODO: call only when needed
}
add_action( 'parse_request', 'wpse9870_parse_request' );
function wpse9870_parse_request( &$wp )
{
if (!empty($wp->query_vars['arevico_api'])) {
switch ($wp->query_vars['arevico_api']){
case "ipn":
print_r($wp->query_vars['ccustfirstname']);
print_r($_POST);
die();
// require_once(AREVICO_PLG_BP . "ipn.php");
// $ArevicoIPN=new ArevicoIPN();
break ;
default:
break;
}
}
return;
}
Note that the getvico_api get parameter gets trough, but the POST parameters don't. I am testing an application by sending sample data via Simple Rest Client for chrome. How to access publishing options
+3
source to share
No one has answered this question yet
Check out similar questions: