<?php
$url = 'https://timsdevorg-developer-edition.na24.force.com/services/apexrest/cms/ocmsrest/';
$fields = array(
'service' => 'OrchestraRenderingAPI',
'apiVersion' => '5.0',
'action' => 'getRenderedContent',
'renderingRequest' => array(
'renderType' => 'originId',
'siteName' => 'OCMSCommunity',
'parameters' => array(
'renderType' => 'originId',
),
'listParameters' => array(
'contentLayouts' => array(
'CustomHtml',
),
'originIds' => array(
'a0F1a000002JDsVEAW',
),
),
),
);
$fields_string = '';
foreach ($fields as $key => $value) {
if (!is_array($value)) {
$fields_string .= $key . '=' . $value . '&';
} else {
$fields_string .= $key . '=' . json_encode($value) . '&';
}
}
$fields_string = rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
$renderings = json_decode($obj->responseObject);
foreach ($renderings as $rendering) {
if (is_array($rendering)) {
foreach ($rendering as $render) {
foreach ($render->renderMap as $renderMap) {
echo htmlspecialchars($renderMap);
}
}
}
}
preferences:
38.43 ms | 402 KiB | 5 Q