我很努力获取远程响应数据以在Gravity Forms确认页面上打印。表单中的数据已成功发布到第三方站点,我的日志显示已收到响应数据,但收到的数据未打印到确认页面。如何接收REMOTE POST响应数据并打印到Gravity Forms确认页面
我已经尝试了很多变化,如;
$request = new WP_Http();
$data = json_decode(wp_remote_retrieve_body($response));
$response = wp_remote_post($post_url, array('body' => $body));
GFCommon::log_debug('gform_confirmation: response => ' . print_r( $response, true));
return $confirmation;
我通过插件提交数据,并与过滤器gform_confirmation,gform_after_submission和gform_entry_post_save无济于事都试过了。
在重力形式的许多支持票;我被告知要做到这一点需要额外的脚本。
谢谢你, 理查德
这是我迄今为止该插件的代码。
add_filter('gform_confirmation_2', 'custom_confirmation', 10, 4);
function custom_confirmation($confirmation, $form, $entry, $ajax) {
$post_url = 'my_post_url';
$body = array(
'VTC_ID' => rgar($entry, '15'),
'Member_ID' => rgar($entry, '16'),
'bname' => rgar($entry, '3'),
'baddress' => rgar($entry, '4'),
'bcity' => rgar($entry, '5'),
'bstate' => rgar($entry, '6'),
'bcountry' => rgar($entry, '7'),
'bzip' => rgar($entry, '8'),
'phone' => rgar($entry, '9'),
'email' => rgar($entry, '17'),
'password' => rgar($entry, '11'),
'isTrial' => rgar($entry, '12'),
'isActive' => rgar($entry, '18'),
'trialStart' => rgar($entry, '13'),
'trialEnd' => rgar($entry, '14'),
);
GFCommon::log_debug('gform_confirmation: body => ' . print_r($body, true));
$request = new WP_Http();
$response = wp_remote_post($post_url, $parameters);
$confirmation .= print_r($response, true);
return $confirmation;
GFCommon::log_debug('gform_confirmation: response => ' . print_r($response, true));
}
问题不明确。你能否详细说明一下? –
我的表单将数据发送到远程站点。发送的数据在远程站点上创建一个用户。 我的表单中有1个字段为空,这会触发远程站点创建帐号。 我试图将帐号打印到本地站点确认页面。 我的重力形式日志显示响应数据(帐号)由本地站点接收,但我不理解如何将该数据打印到确认页面。 – Richard