Wondering how I can store FPDF generated file from form fields in a variable or other for use in CURL request. I am able to upload a file via the file upload e.g input type="file" name="file" manually and post it with CURL but not with the automatically generated pdf file.
Is this possible? See below code:
$noteTitle = (isset($_POST['noteTitle']) ? $_POST['noteTitle'] : null);
$noteBody = (isset($_POST['noteBody']) ? $_POST['noteBody'] : null);
//FPDF
require("fpdf/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont("Arial", "B", 16);
$pdf->Cell(0,100, "Note Title: {$noteTitle} \n", 1, 0, 'C');
$pdf->Cell(0,100, "Note Body: {$noteBody}", 1, 0, 'C');
$filename="test.pdf";
$pdf->output($filename,'f');
$cfile = new CURLFILE($_FILES[$pdf]['tmp_name'], $_FILES[$pdf]['type'], $_FILES[$pdf]['name']);
//Post to curl
$data = array();
$data['FILE_ATTACHMENTS'] = $cfile;
//curl code etc
...