如何使用curl-php与monday.com连接以在monday.com中创建潜在客户或进行交易



我查看了API文档,但没有与curl php相关的示例。

我可以获得一些关于如何连接monday.com以使用curl-php在monday.com中创建潜在客户或交易的指南吗?

我有示例代码(这个代码片段中的Token是错误的(,但我不知道如何传递数据来创建潜在的

<?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);
?>

我不熟悉这个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);