add_action( 'frmapi_post_response', 'frm_save_api_response', 10, 3 );Below is the body of the API response I receive from the first API call. In this case, I want to use the response to redirect a user to the view at https://website.com/?entry_key=4szaj
function frm_save_api_response( $response, $entry, $form_action ) {
$body = json_decode($response['body'], true);
$returned_key = $body['item_key'];
if ( $body['form_id'] == 2) {
header("Location: https://website.com/?entry_key=$returned_key");
) );
}
}
"body": "
{
"id": "198", "item_key": "4szaj", "name": "test 1234", "meta":
{
"ol4jm":
{
"form": "3", "i197":
{
"9j91t": "test", "yg6jl": "2", "x8oih": "test", "9jauh": "4", "o3ajo": "test adsads", "wwko0": "2", "9ou8h": "", "wlpnn": "1", "ekufm": "", "hqbs8": "2.8", "7c3w4": "3.2", "jtg9i": "3.6", "nk7dt": "", "kbx01": "", "yl3nl": "", "wppv4": ""}
},
"9j91t":["test"],"yg6jl":["2"],"x8oih":["test"],"9jauh":["4"],"o3ajo":["test adsads"],"wwko0":["2"],"9ou8h":[""],"wlpnn":["1"],"ekufm":[""],"hqbs8":["2.8"],"7c3w4":["3.2"],"jtg9i":["3.6"],"nk7dt":[""],"kbx01":[""],"yl3nl":[""],"wppv4":[""]
},
"form_id": "2", "post_id": "0", "user_id": "1", "parent_item_id": "0", "is_draft": "0", "updated_by": "1", "created_at": "2022-10-06 02:07:05", "updated_at": "2022-10-06 02:07:05"}", "response":
{
"code":200,"message": "OK"
}
Thanks for your assistance! I was able to get this working by adding the exit() function immediately after the header() function, as suggested.
Please login or Register to submit your answer