title: SOAP-ERROR: Parsing WSDL: Couldn't load from: failed to load external entity
body: <p>I am using an external SOAP API, and I am getting this error:</p>
  
  <pre><code>SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://servis.turkiye.gov.tr/services/g2g/kdgm/uetdsarizi?wsdl' : failed to load external entity "https://servis.turkiye.gov.tr/services/g2g/kdgm/uetdsarizi?wsdl" "
  </code></pre>
  
  <p>The real problem is that sometimes it works just fine. For example, whenever I get this error, I just retype the same code into the page containing my script, and it works temporarily, then I get this error again.</p>
  
  <p>This is my code :</p>
  
  <pre><code> &lt;?php
  try{
  $context = stream_context_create([
      'ssl' =&gt; [
          // set some SSL/TLS specific options
          'verify_peer' =&gt; false,
          'verify_peer_name' =&gt; false,
          'allow_self_signed' =&gt; true
      ]
  ]);
  ini_set('display_errors','On');
  $soapclient = new SoapClient('https://servis.turkiye.gov.tr/services/g2g/kdgm/uetdsarizi?wsdl',
      array(
          'trace' =&gt; 1,
          'exceptions' =&gt; true,
          'login'    =&gt; '***',
          'password' =&gt; '***',
          'stream_context' =&gt; $context
      )
  );
  $param=array('wsuser'=&gt;[
      'kullaniciAdi'=&gt;'***',
      'sifre'=&gt;'***'],
      'uetdsSeferReferansNo'=&gt;'1'
      );
  
  $response =$soapclient-&gt;bildirimOzeti($param);
  $vars = $response -&gt; return;
  $sonucKodu = $vars -&gt; sonucKodu;
  echo $sonucKodu."\n";
  print var_dump($response);
  }catch(Exception $e){
    echo var_dump($e-&gt;getMessage());
    echo var_dump($client-&gt;__getLastRequest());
     echo var_dump($client-&gt;__getLastResponse());
  }
  ?&gt;
  </code></pre>
  
  <p>I need to get rid of this error permanently.</p>