我很努力獲取遠程響應數據以在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