Programmatically Render and Process a Page's HTML Output
Permalink
Hi there,
Does anybody know how to do that or has a hint to point me in the right direction? A Google/ Forum search didn't produce anything helpful and i feel a little lost digging around in the dispatcher, trying to figure out how it's done there.
Intuitively i've tried ways that seem logical to me like that:
The PageView Object seens to hold all the information needed, but it just returns an empty String.
I've also tired to get the Output with a separate Request using curl.:
That basically works... BUT:
When doing that in a Automated Job it only works when the Job is started over the dashboard. When the Job is started from a console context on the Webserver it fails. For instance when using the concrete5 c5:job CLI Command .
Does anybody know how to do that or has a hint to point me in the right direction? A Google/ Forum search didn't produce anything helpful and i feel a little lost digging around in the dispatcher, trying to figure out how it's done there.
Intuitively i've tried ways that seem logical to me like that:
$pv = new PageView( Page::getById($cID) ); $html = $pv->render( );
The PageView Object seens to hold all the information needed, but it just returns an empty String.
I've also tired to get the Output with a separate Request using curl.:
$page = Page::getById( $cID ); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $page->getCollectionLink(), CURLOPT_USERAGENT => 'Render Page Request' )); $html = curl_exec($curl); curl_close($curl);*/
That basically works... BUT:
When doing that in a Automated Job it only works when the Job is started over the dashboard. When the Job is started from a console context on the Webserver it fails. For instance when using the concrete5 c5:job CLI Command .