I need to connect Navision to my PHP application. I have tried to use different ways that I have read in forums but none of them works. I don't know if I should use SOAP, cURL or other, could someone please guide me?
Edit:
I have tried the following code and it does not work either.
$opts = array(
'http' => array(
'user_agent' => 'PHPSoapClient'
)
);
$context = stream_context_create($opts);
$client = new SoapClient('http://URL:7047/DynamicsNAV/WS/COMPANY/Page/mypage?wsdl/', ['trace' => 1, 'cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context ,'user_agent' => 'USERAG', 'soap_version' => SOAP_1_2]);
$security = array(
'UserName' => array(
'UserName'=>'COMPANY\MYUSER',
'Password'=>'mypass',
)
);
$client->__getLastResponse();
$header = new SoapHeader('ChannelFactory','Credentials',$security, false);
$client->__setSoapHeaders($header);
$checkVatParameters = array(
'level' => '01');
$result = $client->checkVat($checkVatParameters);
print_r($result);
try {
$ret = $client->getAllItm();
print_r($ret);
}catch(Exception $e){
echo $e->getMessage();
}
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from myurl