Skip to content

Commit

Permalink
Added explanation of the usage of get_headers().
Browse files Browse the repository at this point in the history
  • Loading branch information
freerk-mpluskassa committed Sep 18, 2018
1 parent 95d7ea1 commit 389db20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Mplusqapiclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,11 @@ public function initClient()

$wsdl_url = $location.'?wsdl';
try {
// Don't wait longer than 5 seconds for the headers
// Don't wait longer than 5 seconds for the headers.
// We call get_headers() here because we want a relatively fast check if the API is available at all
// , before we actually initialize the SoapClient and start running requests
ini_set('default_socket_timeout', 5);
if (false === ($headers = @get_headers($wsdl_url))) {
if (false === @get_headers($wsdl_url)) {
throw new MplusQAPIException(sprintf('Cannot find API WSDL @ %s', $wsdl_url));
}
$this->client = @new SoapClient($wsdl_url, $options);
Expand Down

0 comments on commit 389db20

Please sign in to comment.