我查看了API文档,但没有与curl php相关的示例。
我能得到一些关于如何使用curl php在monday.com中创建销售线索或交易的monday.com的指南吗?
我有示例代码(此代码片段中的Token是错误的),但我不知道如何传递数据来创建lead
<?php
$token = 'eyJhbGciOiJIUzI1NiJ9.0Y-0OesftWBt2SamhvuPV5MR-0Oq7iApMt2exFkDNdM';
$apiUrl = 'https://api.monday.com/v2';
$headers = ['Content-Type: application/json', 'Authorization: ' . $token];
$query = '{ boards (limit:1) {id name} }';
$data = @file_get_contents($apiUrl, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $headers,
'content' => json_encode(['query' => $query]),
]
]));
$responseContent = json_decode($data, true);
echo json_encode($responseContent);
?>发布于 2021-11-11 14:40:07
我对这个monday.com页面并不熟悉,但这就是在PHP中发出cURL请求的方法:
<?php
$token = 'eyJhbGciOiJIUzI1NiJ9.0Y-0OesftWBt2SamhvuPV5MR-0Oq7iApMt2exFkDNdM';
$apiUrl = 'https://api.monday.com/v2';
$headers = ['Content-Type: application/json', 'Authorization: ' . $token];
// Payload
$query = '{ boards (limit:1) {id name} }';
$payload = ['query' => $query];
// Init cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// Exec cURL
$resp = curl_exec($curl);
// Close cURL
curl_close($curl);
// Get response
$response = @json_decode($resp, true);https://stackoverflow.com/questions/69911074
复制相似问题