/
var
/
www
/
html
/
sugar9
/
examples
/
Upload File
HOME
<?php /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ $user_name =''; $user_password = ''; foreach($_POST as $name=>$value){ $$name = $value; } echo <<<EOQ <form name='test' method='POST'> <table width ='800'><tr> <tr><th colspan='6'>Enter SugarCRM User Information - this is the same info entered when logging into sugarcrm</th></tr> <td >USER NAME:</td><td><input type='text' name='user_name' value='$user_name'></td><td>USER PASSWORD:</td><td><input type='password' name='user_password' value='$user_password'></td> </tr> <tr><td><input type='submit' value='Submit'></td></tr> </table> </form> EOQ; if(!empty($user_name)){ $offset = 0; if(isset($_REQUEST['offset'])){ $offset = $_REQUEST['offset'] + 20; echo $offset; } require_once('vendor/nusoap//nusoap.php'); //must also have the nusoap code on the ClientSide. $soapclient = new nusoapclient($GLOBALS['sugar_config']['site_url'].'/soap.php'); //define the SOAP Client an echo '<b>LOGIN:</b><BR>'; $result = $soapclient->call('login',array('user_auth'=>array('user_name'=>$user_name,'password'=>md5($user_password), 'version'=>'.01'), 'application_name'=>'SoapTest')); echo '<b>HERE IS ERRORS:</b><BR>'; echo $soapclient->error_str; echo '<BR><BR><b>HERE IS RESPONSE:</b><BR>'; echo $soapclient->response; echo '<BR><BR><b>HERE IS RESULT:</b><BR>'; echo print_r($result); $session = $result['id']; echo '<br><br><b>GET Case fields:</b><BR>'; $result = $soapclient->call('get_module_fields',array('session'=>$session , 'module_name'=>'Cases')); echo '<b>HERE IS ERRORS:</b><BR>'; echo $soapclient->error_str; echo '<BR><BR><b>HERE IS RESPONSE:</b><BR>'; echo $soapclient->response; echo '<BR><BR><b>HERE IS RESULT:</b><BR>'; echo print_r($result); echo '<br><br><b>Update a portal user fields:</b><BR>'; $result = $soapclient->call('update_portal_user',array('session'=>$session,'portal_name'=>'dan','name_value_list'=>array(array('name'=>'email1', 'value'=>'Dan_Aarons@example.com')))); echo '<b>HERE IS ERRORS:</b><BR>'; echo $soapclient->error_str; echo '<BR><BR><b>HERE IS RESPONSE:</b><BR>'; echo $soapclient->response; echo '<BR><BR><b>HERE IS RESULT:</b><BR>'; echo print_r($result); echo '<br><br><b>Get list of contacts:</b><BR>'; $result = $soapclient->call('get_entry_list',array('session'=>$session,'module_name'=>'Contacts','query'=>'','order_by'=>'contacts.last_name asc','offset'=>$offset, 'select_fields'=>array(), 'max_results'=>'5')); echo '<b>HERE IS ERRORS:</b><BR>'; echo $soapclient->error_str; echo '<BR><BR><b>HERE IS RESPONSE:</b><BR>'; echo $soapclient->response; echo '<BR><BR><b>HERE IS RESULT:</b><BR>'; echo print_r($result); echo '<br><br><b>LOGOUT:</b><BR>'; $result = $soapclient->call('logout',array('session'=>$session)); echo '<b>HERE IS ERRORS:</b><BR>'; echo $soapclient->error_str; echo '<BR><BR><b>HERE IS RESPONSE:</b><BR>'; echo $soapclient->response; echo '<BR><BR><b>HERE IS RESULT:</b><BR>'; echo print_r($result); } ?>