3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); } } } }
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/LX5pZ:37 Stack trace: #0 {main} thrown in /in/LX5pZ on line 37
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Cannot access property on non-object in /in/LX5pZ on line 47 Warning: json_decode() expects parameter 1 to be string, null given in /in/LX5pZ on line 47 Warning: Invalid argument supplied for foreach() in /in/LX5pZ on line 57
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function curl_init() in /in/LX5pZ on line 37
Process exited with code 255.