Created
March 22, 2021 01:13
-
-
Save cherrykoda/14adfecc9554fa1764afae1d7e3c8db2 to your computer and use it in GitHub Desktop.
Curl Call for AX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,"http://domain.com:8201/XXXXX/SERVICENAME/xppservice.svc"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
curl_setopt($ch, CURLOPT_USERPWD, "DOMAIN\username" . ":" . "password"); | |
$headers = array(); | |
$headers[] = "Content-Type: text/xml; charset=\"utf-8\""; | |
$headers[] = "Soapaction:http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/create"; | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
$result = curl_exec($ch); | |
return $result; | |
if (curl_errno($ch)) { | |
echo 'Error:' . curl_error($ch); | |
} | |
curl_close($ch); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment