- file_get_contents: documentation ( source)
- var_dump: documentation ( source)
- print_r: documentation ( source)
- base64_encode: documentation ( source)
<?php
/* dynamic - interactive design - html5 */
$url = "https://editor.pixartprinting.com/services/flexdoc.asmx?WSDL";
// create new SoapClient object
$edoc1 = new SoapClient($url,array('trace' => 1, 'exception' => 0, 'cache_wsdl' => 0));
$user_new = array();
$docCode = "398244e4-2343-4af8-a3e7-eeb70459ae93";
$docPwd = "9adccda9-4a8c-4a7a-9725-9ba5d259c381";
// initialize session by startDocSession
$session_dynamic = $edoc1->startDocSession(array("docCode" => $docCode, "docPwd" => $docPwd));
// and save sessionId
$session_id = $session_dynamic->startDocSessionResult->docSession;
// get info by getCurrentSession
$session_info = $edoc1->getCurrentSession(array("docSessionID"=> $session_id));
$user_info = $session_info->getCurrentSessionResult;
// print get background info
//print "<h3>print get background info ($session_id)</h3><pre>"; print_r($user_info); print "</pre>";
echo "<hr>";
// modify elementValue about first element
$nome_file = "http://apr.pixartprinting.com/test/test.jpg";
$user_new[0] = (object) array(
"elementName" => "background",
"elementValue" => $nome_file,
"imageData" => base64_encode(file_get_contents($nome_file))
);
$user_new = (object) $user_new;
// print userEntries object
print "<h3>userEntries object</h3>";
var_dump($user_new);
// update data by updateCurrentSession using same sessionId and element modified
// print response about update data
print "<h3>print response about update data ($session_id)</h3>";
var_dump($edoc1->updateCurrentSession(array("docSessionID" => $session_id, "userValues"=> $user_new)));
echo "<hr>";
// get info by getCurrentSession using same sessionId
$session_info = $edoc1->getCurrentSession(array("docSessionID"=> $session_id));
// print get background info
print "<h3>print get background info ($session_id)</h3><pre>"; print_r($user_info->inputForm->formElement[0]); print "</pre>";
?>