I have a bizarre situation where I can get the URL
$wsdl = 'https://www.connectwebservice.com/sandbox1_test/services/IR?wsdl over a normal web browser URL buy putting the path into the URL bar, but I cannot seem to connect via also file_get_contents()
does not return anything, though the same code works fine on other connections.
I have built some error diagnostic code if this will help anyone in the future...
<?php
ini_set('display_errors', 'On');
ini_set('memory_limit','1000M');
ini_set("soap.wsdl_cache_enabled", "0");
ini_set("default_socket_timeout", 120);
ini_set("track_errors","On");
error_reporting(E_ALL);
$days = 7;
$date = date('d/m/Y 00:00', (time() - ($days * 24 * 60 * 60)));
$soap_args = array(
'exceptions'=>true,
'cache_wsdl'=>WSDL_CACHE_NONE,
'trace'=>true,
'connection_timeout'=>120,
);
$wsdl = 'https://www.connectwebservice.com/sandbox1_test/services/IR?wsdl';
if(file_get_contents($wsdl)){
try {
$client = new SoapClient($wsdl,$soap_args);
$product = $client->getProductIdsChangedSinceDateStrForType(array("lastRequestDateStr" => $date, "leafOnly" => true))->getProductIdsChangedSinceDateStrForTypeReturn;
} catch (SoapFault $fault) {
var_dump(libxml_get_last_error());
?><br/><br/><pre><?php var_dump($fault); ?></pre><?php
echo "<br/><br/>----------------------<br/><br/>";
echo "Reason: ";
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
//show results if posible
if($client){
if ($product != '') {
$product = split(',', $product);
?>Products:<br/><br/><pre><?php print_r($productIds); ?></pre><?php
echo "<br/><br/>----------------------<br/><br/>";
}
} else {
echo "$client only?";
}
?><br/><br/>Client:<br/><br/><pre><?php print_r($client); ?></pre>
<?php
} else {
echo "<br/>no connection or bad url";
}
`