我想用cURL张贴到Zapier的webhook。张贴到Zapier Webhook的卷曲
Zapier配置,这样如果我输入自己的网址,像这样 - https://zapier.com/hooks/catch/n/[email protected]&guid=foobar
将收到帖子,但是当我尝试做卷曲同样的事情,它似乎并不接受它。
这里是我的代码与卷曲发布 - >
<?php
// Initialize curl
$curl = curl_init();
// Configure curl options
$opts = array(
CURLOPT_URL => 'https://zapier.com/hooks/catch/n/abcd',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => 'guid='+ $_POST["guid"] + '&video_title=' + $_POST["video_title"] + '&email=' + $_POST["email"],
);
// Set curl options
curl_setopt_array($curl, $opts);
// Get the results
$result = curl_exec($curl);
// Close resource
curl_close($curl);
echo $result;
?>
当我运行它,它会显示成功,但Zapier不接受它。
在Zapier的文档,有人举了一个例子以适当卷曲后,像这样 - >
curl -v -H "Accept: application/json" \
-H "Content-type: application/json" \
-X POST \
-d '{"first_name":"Bryan","last_name":"Helmig","age":27}' \
https://zapier.com/hooks/catch/n/Lx2RH/
我猜我失踪的PHP文件的东西,帮助非常感谢!