sugarcrm使用webservice在网页中检索帐户列表
我想使用webservice检索Sugarcrm数据库中的所有帐户数据和联系人数据 我想它显示在一个网页上sugarcrm使用webservice在网页中检索帐户列表,sugarcrm,Sugarcrm,我想使用webservice检索Sugarcrm数据库中的所有帐户数据和联系人数据 我想它显示在一个网页上 我该怎么做呢?根据您的要求修改下面的代码。它使用SugarCRM的SOAP API $user_name = 'admin'; $user_password = 'admin'; $sugarcrm_url = 'http://example.com/' $options = array( "uri" => $sugarcrm_url, "trace" =&g
我该怎么做呢?根据您的要求修改下面的代码。它使用SugarCRM的SOAP API
$user_name = 'admin';
$user_password = 'admin';
$sugarcrm_url = 'http://example.com/'
$options = array(
"uri" => $sugarcrm_url,
"trace" => true
);
$offset = 0;
$limit = 100;
try {
$client = new SoapClient($sugarcrm_url.'service/v4_1/soap.php?wsdl', $options);
$response = $client->__soapCall('login',array(
'user_auth'=>array(
'user_name'=>$user_name,
'password'=>md5($user_password),
'version'=>'.01'
),
'application_name'=>'SoapTest'
));
$session_id = $response->id;
$response = $client->__soapCall('get_entry_list',array(
'session'=>$session_id,
'module_name'=>'Contacts',
'query'=>'',
'order_by'=>'contacts.last_name asc',
'offset'=>$offset,
'select_fields'=>array(),
'max_results'=>$limit)
);
print_r($response);
$response = $client->__soapCall('get_entry_list',array(
'session'=>$session_id,
'module_name'=>'Accounts',
'query'=>'',
'order_by'=>'accounts.name asc',
'offset'=>$offset,
'select_fields'=>array('id', 'name', 'email1'),
'max_results'=>$limit)
);
print_r($response);
$response = $client->__soapCall('logout',array('session'=>$session_id));
} catch (Exception $ex) {
echo $ex->getMessage();
}