<?php
$login = "";
$password = "";
$dataToTimestamp = ""; #load there the PDF document

$destination = "https://".$login.':'.$password."@ws.universign.eu/tsa/pdf/post/";

$eol = "\r\n";
$data = '';
$mime_boundary = md5(time());
$data .= '--'.$mime_boundary.$eol;
$data .= 'Content-Disposition: form-data; name="file"; filename="'.$fileName.'"'.$eol;
$data .= 'Content-Type: text/plain'.$eol;
$data .= 'Content-Transfert-Encoding: base64'.$eol.$eol;
$data .= $dataToTimestamp.$eol;
$data .= "--".$mime_boundary."--".$eol.$eol;
$params = array('http' => array(
			'method' => 'POST',
			'header' => 'Content-Type: multipart/form-data; boundary='.$mime_boundary.$eol,
			'content' => $data
		));


$context = stream_context_create($params);

$tsp = @file_get_contents($destination, FILE_TEXT, $context);

?>
