puiu91
8/10/2016 - 6:46 PM

Reading a PDF xml submission

Reading a PDF xml submission

<?php

$inputStream = null;
$handle = fopen('php://input', 'rb');
while (!feof($handle)) {
    $chunk = fread($handle, 1024); // read in chunks of 1 kb
    $inputStream = = $inputStream . $chunk; // append chunk to input stream
}
fclose($handle);

<?php

$handle = fopen('php://input', 'rb');
$inputStream = stream_get_contents($handle);
fclose($handle);

// is equivalent to...

if ($handle = fopen('php://input', 'rb')) {
    $inputStream = stream_get_contents($handle);
    fclose($handle);
}

// is equiavlent to...

$inputStream = file_get_contents('php://input');

<?php

// retrieve data from input stream
$inputStream = file_get_contents('php://input'); // ... then insert into database