我需要将报价导入vtiger.
我发现可以使用vtiger Web服务API来完成
我找到了参考手册:
https://wiki.vtiger.com/archives/index.php/vtiger510:Webservice_reference_manual
但是我找不到任何示例PHP脚本,也没有我需要传递给webservice.php的数据字段.
请帮助,我需要一些指导.
解决方法:
也许您可以像这样开始(根据您的参考链接).
手册:https://wiki.vtiger.com/archives/index.php/vtiger510:Webservice_reference_manual
登录号:https://wiki.vtiger.com/archives/index.php/vtiger510:Webservice_reference_manual#Login
伪
<?php
class VTiger_Login
{
private $serviceURL = 'http://vtiger_url/webservice.php?operation=login&username=%s&accessKey=%s';
// A Vtiger username.
private $userName = 'my_username';
// An md5 of the concatenation of the challenge token and the user's webservice access key.
private accessKey = 'my_accesskey';
public function login() {
// Open CURL
$ch = curl_init();
// Set URL as same as on manual
curl_setopt($ch, CURLOPT_URL, sprintf($this->serviceURL, $this->userName, $this->accessKey));
// Need POST according to manual
curl_setopt($ch, CURLOPT_POST, 1);
// Receive server response = TRUE
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Exec CURL
$result = curl_exec($ch);
// Close CURL
curl_close($ch);
/*
$result should be like this according to manual;
LoginResult {
sessionId: String // Unique Identifier for the session
userId: String // The vtiger id for the logged in user
version: String // The version of the webservices api
vtigerVersion: String // The version of the vtiger crm.
}
*/
// From manual: All structural data including response from the api is represented as JSON strings.
$result =@ json_decode($result);
// See "Response" on manual
if (null === $result) {
throw new Exception('No response returned from Vtiger server!');
}
// See "ErrorObject" on manual
if (null !== $result->success && false === $result->success) {
throw new Exception('Something went wrong with login operation! errorCode: '.
$result->errorCode .', errorMessage: '. $result->errorMessage);
}
// I think, there is no problem anymore, go with $result after this line...
}
}