I’m using the following and it works unless there’s an apostrophe in the update. I’ve tried addslashes() but that didn’t do it.
// send to Monday.com - update
$board_id = 'XXXXXXXX';
$content = "This isn't working";
$query = '
mutation {
create_update (item_id: '.$board_id.', body: "'.$content.'") {
id
}
}';
$data = @file_get_contents($endpoint, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $endpoint_headers,
'content' => json_encode(['query' => $query], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE),
]
]));