- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
$soap_envelope = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<entity xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Attributes xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>subject</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">Заказ обратного звонка от '.$fio.' ::: '.$subject.'</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>description</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">'.$text.'</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>phonenumber</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">'.$phone.'</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>scheduledend</b:key>
<b:value i:type="c:dateTime" xmlns:c="http://www.w3.org/2001/XMLSchema">'.$dateStr.'</b:value>
= вырезано =
<a:EntityState i:nil="true" />
<a:FormattedValues xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>phonecall</a:LogicalName>
<a:RelatedEntities xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
</entity>
</Create>
</s:Body>
</s:Envelope>';
$soap_action = 'http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Create';
$req_location = 'http://XXXXX/YYYYY/XRMServices/2011/Organization.svc/web';
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'User-Agent: PHP-SOAP-CURL',
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "'.$soap_action.'"'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $req_location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
curl_setopt($ch, CURLOPT_POSTFIELDS, $soap_envelope);
$response = curl_exec($ch);
if($response !== false)
Комментарии (0) RSS
Добавить комментарий