<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mentionlab.io/api/v2/projects/{projectId}/jobs/{jobId}/executions/{executionId}/answer",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'success',
'text' => 'The best running shoes of 2026 are ...',
'citations' => [
[
'url' => 'https://www.example.com/guides/running-shoes'
]
],
'listings' => [
[
'name' => 'Pegasus 41',
'position' => 1
]
],
'fanOuts' => [
[
'phrase' => 'best running shoes 2026'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}