本文整理汇总了PHP中SoapClient::CreateDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::CreateDocument方法的具体用法?PHP SoapClient::CreateDocument怎么用?PHP SoapClient::CreateDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::CreateDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildResume
function buildResume($format)
{
// Turn off WSDL caching
ini_set('soap.wsdl_cache_enabled', 0);
// Define credentials for LD
define('USERNAME', 'rsimha01');
define('PASSWORD', 'prannu35');
// SOAP WSDL endpoint
define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL');
// Define timezone
date_default_timezone_set('Europe/Berlin');
// -----------------------------------------------------------------------------
//
// SAMPLE #1 - License Agreement
//
// Instantiate SOAP object and log into LiveDocx
$soap = new SoapClient(ENDPOINT);
$soap->LogIn(array('username' => USERNAME, 'password' => PASSWORD));
// Upload template
$data = file_get_contents('template.docx');
$soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => 'docx'));
// Assign data to template
$fieldValues = array('first_name' => $this->firstname, 'last_name' => $this->lastname, 'street_name' => $this->address, 'city' => $this->city, 'state' => $this->state, 'zip' => $this->zip, 'phone_no' => $this->phone, 'email' => $this->email, 'company_name' => $this->company['company_name'], 'years' => $this->company['years'], 'job_title' => $this->company['job_title'], 'job_description' => $this->company['job_description'], 'degree' => $this->school['degree'], 'school' => $this->school['school'], 'school_dates' => $this->school['dates'], 'skills' => $this->skills[0]);
$soap->SetFieldValues(array('fieldValues' => $this->assocArrayToArrayOfArrayOfString($fieldValues)));
// Build the document
$soap->CreateDocument();
// Get document as PDF
$result = $soap->RetrieveDocument(array('format' => $format));
$data = $result->RetrieveDocumentResult;
file_put_contents('resume.' . $format . '', base64_decode($data));
return "resume." . $format;
$soap->LogOut();
unset($soap);
print 'DONE.' . PHP_EOL;
}
示例2: convertToDocx
function convertToDocx($filepath, $format)
{
// Turn up error reporting
error_reporting(E_ERROR | E_PARSE);
// Turn off WSDL caching
ini_set('soap.wsdl_cache_enabled', 0);
//// Define credentials for LD
//define ('USERNAME', 'yourUsername');
//define ('PASSWORD', 'yourPassword');
// SOAP WSDL endpoint
define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL');
// Define timezone
date_default_timezone_set('Europe/Berlin');
// -----------------------------------------------------------------------------
//
// SAMPLE #1 - License Agreement
//
// Instantiate SOAP object and log into LiveDocx
$soap = new SoapClient(ENDPOINT);
$soap->LogIn(array('username' => rsimha01, 'password' => prannu35));
// Upload template
$data = file_get_contents($filepath);
$soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => $format));
// Build the document
$soap->CreateDocument();
// Get document as docx
$result = $soap->RetrieveDocument(array('format' => 'docx'));
$data = $result->RetrieveDocumentResult;
file_put_contents('files/resume.zip', base64_decode($data));
}
示例3: export
public function export()
{
require_once 'libs/nusoap/nusoap.php';
if ($this->Input->get('key') != 'pdf') {
return '';
}
$thisID = $this->Input->get('id');
// Turn off WSDL caching
ini_set('soap.wsdl_cache_enabled', 0);
// SOAP WSDL endpoint
define('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?wsdl');
// Define timezone
date_default_timezone_set('Europe/Berlin');
// Instantiate nuSOAP Client
$soap = new SoapClient(ENDPOINT);
// Set charset encoding for outgoing messages
// $soap ->soap_defencoding = 'UTF-8';
$soap->LogIn(array('username' => $GLOBALS['TL_CONFIG']['livedocx_username'], 'password' => $GLOBALS['TL_CONFIG']['livedocx_password']));
// Upload template
$data = file_get_contents('templates/invoice-template.docx', FILE_USE_INCLUDE_PATH);
// Assign field values data to template
$soap->SetLocalTemplate(array('template' => base64_encode($data), 'format' => 'docx'));
/* //debug
$fieldNames = $soap->getFieldNames();
print_r($fieldNames);
exit;
*/
$event = $this->Database->prepare("SELECT * FROM tl_pic_invoices WHERE id=?")->limit(1)->execute($thisID);
if (!$event->numRows) {
$this->log('Event not found', 'export_to_pdf()', TL_ERROR);
header('Location: ?do=Invoices');
return;
}
$name = $this->Database->prepare("SELECT * FROM tl_pic_customer_company WHERE id=?")->limit(1)->execute($event->customer_company_id);
$address = $this->Database->prepare("SELECT * FROM tl_pic_customer_addresses WHERE pid=?")->limit(1)->execute($event->customer_company_id);
$objInvoice = $this->Database->prepare("SELECT services FROM tl_pic_invoices WHERE id=?")->limit(1)->execute($thisID);
$services = unserialize($objInvoice->services);
$invoice_date = $event->invoice_date;
$this->invoice_label = $_invoice_label;
$format = 'd/m/Y';
$this->invoice_date = gmdate($format, $invoice_date);
$event->invoice_date = gmdate($format, $invoice_date);
$fieldValues = array('logo' => $GLOBALS['TL_CONFIG']['logo'], 'company_name' => $GLOBALS['TL_CONFIG']['company_name'], 'address1' => $GLOBALS['TL_CONFIG']['company_address1'], 'address2' => $GLOBALS['TL_CONFIG']['company_address2'], 'city' => $GLOBALS['TL_CONFIG']['company_city'], 'postcode' => $GLOBALS['TL_CONFIG']['company_postcode'], 'phone' => $GLOBALS['TL_CONFIG']['company_phone'], 'num' => $GLOBALS['TL_CONFIG']['company_number'], 'taxnum' => $GLOBALS['TL_CONFIG']['company_taxnumber'], 'invoice_label' => $event->invoice_label, 'invoice_date' => $event->invoice_date, 'customer_company_name' => $name->customer_company_name, 'street' => $address->street, 'city' => $address->city, 'postal' => $address->postal, 'id' => $event->id, 'invoice_purchase_order' => $event->invoice_purchase_order, 'invoice_remaining_days' => $GLOBALS['TL_CONFIG']['invoice_remaining_days'], 'company_bankname' => $GLOBALS['TL_CONFIG']['company_bankname'], 'company_bankcode' => $GLOBALS['TL_CONFIG']['company_bankcode'], 'company_bankaccountnumber' => $GLOBALS['TL_CONFIG']['company_bankaccountnumber'], 'company_name' => $GLOBALS['TL_CONFIG']['company_name'], 'contact_firstname' => $GLOBALS['TL_CONFIG']['contact_firstname'], 'contact_lastname' => $GLOBALS['TL_CONFIG']['contact_lastname'], 'contact_phone' => $GLOBALS['TL_CONFIG']['contact_phone'], 'contact_email' => $GLOBALS['TL_CONFIG']['contact_email'], 'tax_applied' => $GLOBALS['TL_CONFIG']['tax_applied']);
$sum = 0;
$array_size = sizeof($services);
for ($i = 0; $i < $array_size; $i++) {
$sum = $sum + $services[$i]['cost'] * $services[$i]['quantity'];
$fieldValues = $fieldValues + array('service_' . $i => $services[$i]['title'], 'price_' . $i => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['cost'], 'qty_' . $i => $services[$i]['quantity'], 'amount_' . $i => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['cost'] * $services[$i]['quantity']);
}
$fieldValues = $fieldValues + array('sum' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $sum, 'vat' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . ($vat = $sum * $GLOBALS['TL_CONFIG']['tax_applied'] / 100), 'sumvat' => $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . ($sum + $vat));
$result = $soap->SetFieldValues(array('fieldValues' => $this->nuSoap_assocArrayToArrayOfArrayOfString($fieldValues)));
// Build the document
$soap->CreateDocument();
// Get document as PDF
$result = $soap->RetrieveDocument(array('format' => 'pdf'));
$data = $result->RetrieveDocumentResult;
$soap->LogOut();
unset($soap);
$invoice_name = $GLOBALS['TL_CONFIG']['invoice_title'] . $event->invoice_date . "-" . $event->invoice_number;
$GLOBALS['TL_CONFIG']['invoice_startnum']++;
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename="' . $invoice_name . '.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
//$soap->Output($invoice_name . '.pdf', $GLOBALS['TL_CONFIG']['invoice_path']);
header('Pragma: public');
echo base64_decode($data);
return;
}
示例4:
$result = $client->GetRest(array('Good' => $_POST['xml']));
} else {
$error = "101. Нет входящих данных.";
}
break;
case "102":
if (!empty($_POST['xml'])) {
$result = $client->GetPrice(array('Good' => $_POST['xml']));
} else {
$error = "102. Нет входящих данных.";
}
break;
case "103":
//103 ОформлениеЗаказаПокупателя
if (!empty($_POST['xml'])) {
$result = $client->CreateDocument(array('Good' => $_POST['xml']));
// file_put_contents($_SERVER['DOCUMENT_ROOT']."/t.txt",$result->return);
// file_put_contents($_SERVER['DOCUMENT_ROOT']."/t.txt",$_POST['xml']);
} else {
$error = "103. Нет входящих данных.";
}
break;
case "104":
//104 ЗапросСтатусаЗаказаПокупателя
if (!empty($_POST['xml'])) {
$result = $client->GetStatus(array('Good' => $_POST['xml']));
} else {
$error = "104. Нет входящих данных.";
}
break;
case "105":
示例5: export
//.........这里部分代码省略.........
$id = (string) $i + 1;
$blockFieldValues[$i]['service_name_' . (string) $i] = $current_service->service_name;
$blockFieldValues[$i]['service_description_' . (string) $i] = $current_service->service_description;
$blockFieldValues[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent'];
$blockFieldValues[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price'];
$blockFieldValues[$i]['id_' . (string) $i] = "2." . $id . " ";
$blockFieldValues[$i]['p_' . (string) $i] = $page;
$i++;
}
$array_size = sizeof($services);
$sum_days = 0;
$sum = 0;
$blockFieldValues2 = array();
$i = 0;
while ($i < $array_size) {
$current_service = $this->Database->prepare("SELECT * FROM tl_pic_services WHERE id=?")->limit(1)->execute($services[$i]['service']);
$sum_days = $sum_days + $services[$i]['days_spent'];
$sum = $sum + $services[$i]['price'];
if ($i >= 0 && $i <= 5) {
$page = 5;
}
if ($i >= 6 && $i <= 10) {
$page = 6;
}
if ($i >= 11 && $i <= 15) {
$page = 7;
}
$id = (string) $i + 1;
$blockFieldValues2[$i]['service_name_' . (string) $i] = $current_service->service_name;
$blockFieldValues2[$i]['service_description_' . (string) $i] = $current_service->service_description;
$blockFieldValues2[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent'];
$blockFieldValues2[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price'];
$blockFieldValues2[$i]['id_' . (string) $i] = "2." . $id . " ";
$blockFieldValues2[$i]['p_' . (string) $i] = $page;
$i++;
}
$array_size = sizeof($services);
$sum_days = 0;
$sum = 0;
$blockFieldValues3 = array();
$i = 0;
while ($i < $array_size) {
$current_service = $this->Database->prepare("SELECT * FROM tl_pic_services WHERE id=?")->limit(1)->execute($services[$i]['service']);
$sum_days = $sum_days + $services[$i]['days_spent'];
$sum = $sum + $services[$i]['price'];
if ($i >= 0 && $i <= 5) {
$page = 5;
}
if ($i >= 6 && $i <= 10) {
$page = 6;
}
if ($i >= 11 && $i <= 15) {
$page = 7;
}
$id = (string) $i + 1;
$blockFieldValues3[$i]['service_name_' . (string) $i] = $current_service->service_name;
$blockFieldValues3[$i]['service_description_' . (string) $i] = $current_service->service_description;
$blockFieldValues3[$i]['days_spent_' . (string) $i] = $services[$i]['days_spent'];
$blockFieldValues3[$i]['price_' . (string) $i] = $GLOBALS['TL_CONFIG']['company_defaultCurrency'] . $services[$i]['price'];
$blockFieldValues3[$i]['id_' . (string) $i] = "2." . $id . " ";
$blockFieldValues3[$i]['p_' . (string) $i] = $page;
$i++;
}
$avp = 6;
$last = 7;
if ($array_size > 6) {
$avp = 7;
$last = 8;
}
if ($array_size > 11) {
$avp = 8;
$last = 9;
}
$custom_fields = unserialize($objProposal->custom_fields);
$custom_fields_size = sizeof($custom_fields);
for ($i = 0; $i < $custom_fields_size; $i++) {
$fieldValues = $fieldValues + array($custom_fields[$i]['field_name'] => $custom_fields[$i]['value']);
}
$fieldValues = $fieldValues + array('sum' => $sum, 'sum_days' => $sum_days, 'avp' => $avp, 'last' => $last);
$result = $soap->SetFieldValues(array('fieldValues' => $this->nuSoap_assocArrayToArrayOfArrayOfString($fieldValues)));
$soap->SetBlockFieldValues(array('blockName' => 'content', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues)));
$soap->SetBlockFieldValues(array('blockName' => 'content_menu', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues2)));
$soap->SetBlockFieldValues(array('blockName' => 'content_array', 'blockFieldValues' => $this->nuSoap_multiAssocArrayToArrayOfArrayOfString($blockFieldValues3)));
// Build the document
$soap->CreateDocument();
// Get document as PDF
$result = $soap->RetrieveDocument(array('format' => 'pdf'));
$data = $result->RetrieveDocumentResult;
$soap->LogOut();
unset($soap);
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename="' . $event->proposal_label . '.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo base64_decode($data);
return;
} else {
echo 'LivedocX only is available at the moment !';
}
}
示例6: resman_livedocx_create_documents
//.........这里部分代码省略.........
// GENERAL
$sql = 'SELECT d.value AS value, f.name AS name FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="general";';
$data = $wpdb->get_results($sql, ARRAY_A);
$fieldValues['general-count'] = 0;
foreach ($data as $item) {
$fieldValues['general-' . $item['name']] = $item['value'];
$fieldValues['general-count']++;
}
// EXPERIENCE
$sql = 'SELECT d.value AS value, f.name AS name, d.repeatgroup_count AS repeatgroup FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="experience" ORDER BY d.repeatgroup_count;';
$data = $wpdb->get_results($sql, ARRAY_A);
$experience = array();
$fieldValues['experience-count'] = 0;
foreach ($data as $item) {
switch ($item['name']) {
case 'start':
case 'end':
$experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = date($dateformat, strtotime($item['value']));
break;
case 'abstract':
$experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = resman_livedocx_format_abstract($item['value']);
break;
default:
$experience[$item['repeatgroup'] - 1]['experience-' . $item['name']] = $item['value'];
}
}
$fields = array('start', 'end', 'title', 'abstract', 'name', 'address', 'sector');
$expBlock = array();
foreach ($experience as $key => $exp) {
if (!isset($experience[$key]['experience-start'])) {
$experience[$key]['experience-start'] = __('Present', 'resman');
}
if (!isset($experience[$key]['experience-end'])) {
$experience[$key]['experience-end'] = __('Present', 'resman');
}
foreach ($fields as $field) {
if (!isset($experience[$key]['experience-' . $field])) {
$experience[$key]['experience-' . $field] = '';
}
$expBlock[$fieldValues['experience-count']]['experience-' . $field] = $experience[$key]['experience-' . $field];
}
$fieldValues['experience-count']++;
}
$ldx->SetBlockFieldValues(array('blockName' => 'experience', 'blockFieldValues' => resman_multiAssocArrayToArrayOfArrayOfString($expBlock)));
// EDUCATION
$sql = 'SELECT d.value AS value, f.name AS name, d.repeatgroup_count AS repeatgroup FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="education" ORDER BY d.repeatgroup_count;';
$data = $wpdb->get_results($sql, ARRAY_A);
$education = array();
$fieldValues['education-count'] = 0;
foreach ($data as $item) {
switch ($item['name']) {
case 'start':
case 'end':
$education[$item['repeatgroup'] - 1]['education-' . $item['name']] = date($dateformat, strtotime($item['value']));
break;
case 'abstract':
$education[$item['repeatgroup'] - 1]['education-' . $item['name']] = resman_livedocx_format_abstract($item['value']);
break;
default:
$education[$item['repeatgroup'] - 1]['education-' . $item['name']] = $item['value'];
}
}
$fields = array('start', 'end', 'title', 'abstract', 'name', 'address', 'field');
$eduBlock = array();
foreach ($education as $key => $exp) {
if (!isset($education[$key]['education-start'])) {
$education[$key]['education-start'] = __('Present', 'resman');
}
if (!isset($education[$key]['education-end'])) {
$education[$key]['education-end'] = __('Present', 'resman');
}
foreach ($fields as $field) {
if (!isset($education[$key]['education-' . $field])) {
$education[$key]['education-' . $field] = '';
}
$eduBlock[$fieldValues['education-count']]['education-' . $field] = $education[$key]['education-' . $field];
}
$fieldValues['education-count']++;
}
$ldx->SetBlockFieldValues(array('blockName' => 'education', 'blockFieldValues' => resman_multiAssocArrayToArrayOfArrayOfString($eduBlock)));
// SKILLS
$sql = 'SELECT d.value AS value, f.name AS name FROM ' . $wpdb->prefix . 'resman_data AS d LEFT JOIN ' . $wpdb->prefix . 'resman_fields AS f on f.id = d.fieldid WHERE f.section="skills";';
$data = $wpdb->get_results($sql, ARRAY_A);
$fieldValues['skills-count'] = 0;
foreach ($data as $item) {
$fieldValues['skills-' . $item['name']] = resman_livedocx_format_abstract($item['value']);
$fieldValues['skills-count']++;
}
$ldx->SetFieldValues(array('fieldValues' => resman_assocArrayToArrayOfArrayOfString($fieldValues)));
$ldx->CreateDocument();
resman_livedocx_write_document($ldx, 'html');
$doctypes = array('txt', 'pdf', 'doc', 'docx', 'rtf');
foreach ($doctypes as $doc) {
if (get_option('resman_output_' . $doc)) {
resman_livedocx_write_document($ldx, $doc);
}
}
$ldx->LogOut();
unset($ldx);
}