I am trying to use PHP to connect to ServiceNow and retrieve incident records.
I tried to use the code below but somehow I receive errors:
<?php
$credentials = array('login'=> 'user', 'password'=>'pa ss');
$client = new SoapClient("htt ps://blah.com/incident.do?WSD L", $credentials);
$params = array('param1' => 'value1', 'param1' => 'value1');
$result = $client->__soapCall('ge tRecords', array('paramete rs' => $params));
// result array stored in $result->getRecordsResu lt
?>
I am always getting:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https : // blah . service-now . com / incident.do?WSD L' : failed to load external entity "https : // blah . service-now.com / incident.do?WSD L" in /var/www/index.php:3 Stack trace: #0 /var/www/index.php(3): SoapClient->SoapClient('ht tps://blah.ser...', Array) #1 {main} thrown in /var/www/index.php on line 3
Of course I use the servicenow subdomain I want instead of blah. But let's assume it's blah.
Please help me. Is this code ok? Where do I place my username? On the user area? or in the login area? What about param1 and value1, which one of these do I need to change?
Yes, I have permission to do this on my servicenow instance, I can do other things regarding soap and wsdl.
I tried to use the code below but somehow I receive errors:
<?php
$credentials = array('login'=> 'user', 'password'=>'pa ss');
$client = new SoapClient("htt ps://blah.com/incident.do?WSD L", $credentials);
$params = array('param1' => 'value1', 'param1' => 'value1');
$result = $client->__soapCall('ge tRecords', array('paramete rs' => $params));
// result array stored in $result->getRecordsResu lt
?>
I am always getting:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https : // blah . service-now . com / incident.do?WSD L' : failed to load external entity "https : // blah . service-now.com / incident.do?WSD L" in /var/www/index.php:3 Stack trace: #0 /var/www/index.php(3): SoapClient->SoapClient('ht tps://blah.ser...', Array) #1 {main} thrown in /var/www/index.php on line 3
Of course I use the servicenow subdomain I want instead of blah. But let's assume it's blah.
Please help me. Is this code ok? Where do I place my username? On the user area? or in the login area? What about param1 and value1, which one of these do I need to change?
Yes, I have permission to do this on my servicenow instance, I can do other things regarding soap and wsdl.