Seiteninhalt holen
Seite per Email versenden
Um z.B. den Inhalt einer Seite per Email versenden zu können (in diesem Fall ein PDF, welches beim SeitenTyp 123 konfiguriert ist) geht folgendes:
# base name
$zipFolderName = 'uploads/tx_rsysworkbook/pdf/';
# unique name
$uniqueName = time();
# URL params
$args = array(
'tx_rsysworkbook_register[action]' => 'listPdf',
'tx_rsysworkbook_register[controller]' => 'FrontendUser',
'tx_rsysworkbook_register[frontendUser]' => $this->user,
'type' => '123'
);
# build URL
$link = $this->uriBuilder
->setArguments($args)
->setTargetPageUid($this->settings['downloadPid'])
->setNoCache(1)
->uriFor('listPdf');
// get content
$hostname = $this->request->getBaseURI();
$specsheetFileName = $zipFolderName . 'Download_' . $uid . '_' . $uniqueName . '.pdf';
// get cookie
$cookie = $_COOKIE["fe_typo_user"];
// get content and write to file
$ch = curl_init($hostname . $link);
$fp = fopen($specsheetFileName, "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
// curl_setopt($ch, CURLOPT_COOKIE, 'fe_typo_user='.$cookie.';expires=End Of Session;Path=/;Domain=default-site-developer-4.7');
curl_exec($ch);
curl_close($ch);
fclose($fp);
# send it somewhere...
$this->sendMailWithAttachment($frontendUser,$specsheetFileName);