本文介绍了使用Web服务将引号导入vtiger crm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将引号导入 vtiger
。
我发现可以使用vtiger Web服务API完成
I need to import quotes into vtiger
.I find out it can be be done using vtiger web services API
我找到了参考手册:
但是我找不到任何示例PHP脚本,我都不需要将哪些数据字段传递给 webservice.php
。
But i can't find any example PHP script, neither what data fields I need to pass to webservice.php
.
请帮忙,我需要一些指导。
Please help, I need some guidance.
推荐答案
也许你可以这样开始(根据你的参考链接)。
Maybe you can start like this (according to your reference link).
手册:
登录:
伪;
<?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...
}
}
这篇关于使用Web服务将引号导入vtiger crm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!