I'm trying to grab the value of a single form field, on a single form, and put it into a remote POST call.
[php]
add_action("gform_post_submission_4", "subscribe_textmarks", 10, 2);
function subscribe_textmarks($entry, $form){
//first, let's grab the phone number from the form, it's field 1
$phone = get_post($entry["1"]);
//now let's remotely subscribe to textmarks by calling their API via POST
$response = wp_remote_post('http://help.api2.textmarks.com//Anybody/invite_to_group/', array(
'method' => 'POST',
'headers' => array(),
'body' => array( 'api_key' => 'chrislema_com__72225807', 'tm' => 'WORDPRESS', 'user' => $phone )
)
);
}
You can see by the initial _4 appended to the hook, I was trying to get this to only fire on a specific form.
When I put in the value, the form submits, I see the thank you text, but nothing seems to get out to the remote server.
Am I calling this wrong?