答案:
使用此 PHP 代码将数据发送到 Zapier 的 Webhooks 中的 Catch Hook
只需将表单中的 PHP 发布数据填充到 http_build_query 并将其卷曲到 webhook url。完毕。
//first off, set up all my post data
if(is_array($_POST)){ foreach ($_POST as $key => $value) { ${$key} = $value; } }
// now all my post data is available as PHP vars
//(matching my html form input names)
// <input name=first_name
// then ->becomes $_POST['first_name']
// then ->becomes var $first_name;
// now rename and assign vars
$_ZAP_ARRAY = array(
"test_var_1" => "test data",
"test_var_2" => "test data bbb",
"test_var_3" => "test data ccc",
"test_var_4" => "test ddd",
"set_your_var_here" => $set_post_data_here,
"zap_f_name" => $first_name /
);
// stuff it into a query
$_ZAP_ARRAY = http_build_query($_ZAP_ARRAY );
// get my zap URL
$ZAPIER_HOOK_URL = "https://hooks.zapier.com/hooks/catch/000000/xxxxxx/"
// curl my data into the zap
$ch = curl_init( $ZAPIER_HOOK_URL);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $_ZAP_ARRAY);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
// done
恕我直言,应该在这些页面上: