我想用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文件的東西,幫助非常感謝!