PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了PHP-使用Web服务将报价导入vtiger crm大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我需要将报价导入vtiger.
我发现可以使用vtiger Web服务API来完成@H_419_2@

我找到了参考手册:
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...
    }
}

大佬总结

以上是大佬教程为你收集整理的PHP-使用Web服务将报价导入vtiger crm全部内容,希望文章能够帮你解决PHP-使用Web服务将报价导入vtiger crm所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: