WAMP也使用相同的方法。 这给我LAMP错误。 请建议我该怎么办。
我的代码URL:How To Create a case Or Incident In Microsoft Dynamics Online CRM using php-crm-toolkit
在以下第22行出现错误
“ $ service =新的OrganizationService($ serviceSettings);”
print_r($_POST);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// error_reporting(0);
// ini_set('display_errors', 0);
/**
* Use init.php if you didn't install the package via Composer
*/
require_once 'vendor/autoload.php';
use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;
use AlexaCRM\CRMToolkit\Client;
use AlexaCRM\CRMToolkit\Entity\MetadataCollection;
use AlexaCRM\CRMToolkit\Entity\EntityReference;
$options = include( 'config.php' );
$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );
$clientSettings = new Settings( $options );
$client = new Client( $clientSettings );
$metadata = MetadataCollection::instance( $client );
$contactid = '';
$request_type = trim($_POST['request_type']);
$file_uploadName = '';
switch($request_type) {
case 'call_you':
$firstname = $lastname = trim($_POST['name']);
$title = trim($_POST['order']);
$description = trim($_POST['message']);
$phone = trim($_POST['phone']);
$emailaddress1 = '';
$search_node = "<condition attribute='mobilephone' operator='like' value='%".$phone."%' />";
break;
case 'support_email':
$firstname = $lastname = '';
$emailaddress1 = trim($_POST['email']);
$title = trim($_POST['subject']);
$description = trim($_POST['message']);
$search_node = "<condition attribute='emailaddress1' operator='like' value='%".$emailaddress1."%' />";
$file_upload = base64_encode(file_get_contents( $_FILES["file_upload"]["tmp_name"] ));
$file_uploadType = $_FILES["file_upload"]["type"];
$file_uploadName = $_FILES["file_upload"]["name"];
//echo '<br/>support_email - case<br/>';
break;
case 'submit_request':
$firstname = $lastname = '';
$emailaddress1 = trim($_POST['email']);
$title = ($_POST['requestSelect']).' - '.trim($_POST['subject']);
$description = trim($_POST['message']);
$search_node = "<condition attribute='emailaddress1' operator='like' value='%".$emailaddress1."%' />";
$file_upload = base64_encode(file_get_contents( $_FILES["file_upload"]["tmp_name"] ));
$file_uploadType = $_FILES["file_upload"]["type"];
$file_uploadName = $_FILES["file_upload"]["name"];
//echo '<br/>support_email - case<br/>';
break;
case 'customer_service':
$firstname = $lastname = trim($_POST['name']);
$title = trim($_POST['order']);
$description = trim($_POST['message']);
$phone = trim($_POST['phone']);
$emailaddress1 = '';
$search_node = "<condition attribute='mobilephone' operator='like' value='%".$phone."%' />";
break;
}
$queryXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='contact'>
<attribute name='contactid' />
<filter type='and'>
".$search_node."
</filter>
</entity>
</fetch>";
$contacts = $client->retrieveSingle($queryXML, $allPages = false, $pagingCookie = null, $limitCount = 10, $pageNumber = 1, $simpleMode = false);
if(isset($contacts)) {
$contactid = $contacts->contactid;
$emailaddress1 = $contacts->emailaddress1;
}
if(trim($contactid) != '') {
$guid = $contactid;
} else {
$contact = $service->entity( 'contact' );
$contact->firstname = $firstname;
$contact->lastname = $lastname;
$contact->emailaddress1 = $emailaddress1;
$guid = $contact->create();
}
$incident = $service->entity('incident');
//echo '<pre>';print_r($incident);echo '</pre>';
$incident->title = $title;
$incident->description = $description;
$incident->customerid = new EntityReference( 'contact', $guid );
//$incident->ID = $guid;//contactid responsiblecontactid primarycontactid
$incidentId = $incident->create();
if($file_uploadName != '') {
//echo $file_uploadName;
$note = $service->entity('annotation');
$note->objectid = new EntityReference( 'incident', $incidentId );
$note->subject = $title;
$note->documentbody = $file_upload;
$note->mimetype = $file_uploadType;//"text/plain";
$note->notetext = $note;
$note->filename = $file_uploadName;
//echo '<pre>';print_r($note);echo '</pre>';die();
$noteId = $note->create();
}
echo "<br/>Case has been created for your query.";
?>`
Fatal error: Uncaught Error: Call to undefined function AlexaCRM\CRMToolkit\Auth\curl_version() in /var/www/html/php_crm/vendor/alexacrm/php-crm-toolkit/src/Auth/Authentication.php:60 Stack trace: #0 /var/www/html/php_crm/vendor/alexacrm/php-crm-toolkit/src/Auth/OnlineFederation.php(39): AlexaCRM\CRMToolkit\Auth\Authentication->__construct(Object(AlexaCRM\CRMToolkit\Settings), Object(AlexaCRM\CRMToolkit\Client)) #1 /var/www/html/php_crm/vendor/alexacrm/php-crm-toolkit/src/Client.php(156): AlexaCRM\CRMToolkit\Auth\OnlineFederation->__construct(Object(AlexaCRM\CRMToolkit\Settings), Object(AlexaCRM\CRMToolkit\Client)) #2 /var/www/html/php_crm/create_case.php(23): AlexaCRM\CRMToolkit\Client->__construct(Object(AlexaCRM\CRMToolkit\Settings)) #3 {main} thrown in /var/www/html/php_crm/vendor/alexacrm/php-crm-toolkit/src/Auth/Authentication.php on line 60