我正在尝试通过Laravel 5中的网络服务在Vtiger中提交/创建新的Leadsdata。为此,我在Laravel中使用了WSClient。
我的代码在控制器中是:
$url = http://xxxx.com;
$config = [
'auth' => [
'username' => 'xxxx',
'accesskey' => 'xxxx'
],
'testing' => []
];
$wsclient = new WSClient($url, $config);
$create = $wsclient->createObject('Leads', array(
'firstname' => 'My Firstname',
'lastname'=>'My Lastname',
'phone'=>'MyPhone',
'email'=>'email@email.com',
'description'=> 'abcdabcd123',
'assigned_user_id'=>1,
));
当我创建Leads
时,它工作得很好。但是现在我需要在Leads
文档中提交文件,所以我使用了跟随代码而不是Works
$create = $wsclient->createObject('Documents', array(
'notes_title' => 'Leads Pdf File',
'file'=>'http://website/pdffile.pdf',
'assigned_user_id'=>1,
));
它可以工作,但不能上传文件
如何在Vtiger中通过Laravel
的Web服务通过WSClinet
提交Leads
文件?
发布于 2016-07-20 13:11:57
您的代码是正确的,但目前Vtiger web服务不提供将文件上传到服务器上的可能性。
如果您的服务器上托管了该文件,则可以将文档创建为:
$create = $wsclient->createObject('Documents', array(
'notes_title' => 'Leads Pdf File',
'file'=>'http://website/pdffile.pdf',
'filelocationtype' => 'External', //This will create a link to your server from the crm
'assigned_user_id'=>1,
));
或者,您可以扩展Vtiger webservices代码,使其可以下载并导入文件。
https://stackoverflow.com/questions/38451286
复制相似问题