Gravity Forms 提交给第三方从响应中检索值

问题描述

我正在尝试使用 gform_after_submission 方法将我的表单数据提交给第三方 API,第一部分对我来说非常简单,但是在初始 API 调用后,将发送回包含 ID 值的响应,我然后需要使用响应中给出的 ID 值,然后在另一个 API 调用中发送。

请看下面我目前使用的代码

add_action( 'gform_after_submission','post_to_third_party',10,2 );
function post_to_third_party( $entry,$form ) {
 
    $endpoint_url = 'https://thirdparty.com';
    $body = array(
        'first_name' => rgar( $entry,'1.3' ),'last_name' => rgar( $entry,'1.6' ),'message' => rgar( $entry,'3' ),);
    GFCommon::log_debug( 'gform_after_submission: body => ' . print_r( $body,true ) );
 
    $response = wp_remote_post( $endpoint_url,array( 'body' => $body ) );
    GFCommon::log_debug( 'gform_after_submission: response => ' . print_r( $response,true ) );
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)