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'=>'pass');
$client = new SoapClient("https://blah.com/incident.do?WSDL", $credentials);
$params = array('param1' => 'value1', 'param1' => 'value1');
$result = $client->__soapCall('getRecords', array('parameters' => $params));
// result array stored in $result->getRecordsResult
?>
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?WSDL' : failed to load external entity "https : // blah . service-now.com / incident.do?WSDL" in /var/www/index.php:3 Stack trace: #0 /var/www/index.php(3): SoapClient->SoapClient('https://blah.ser...', Array) #1 {main} thrown in /var/www/index.php on line 3
Of course I use the 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.