title: How to handle 500 internal server error when using file_get_contents with a wrong proxy?
body: <p>If i run this code in PHP <strong>with a wrong proxy</strong> I get 500 internal server error.
  How to handle it and continue execution?</p>
  
  <pre><code>$opts = array(
            'http'=&gt;array(
              'method'=&gt;"GET",
              'proxy' =&gt; 'tcp://100.100.100.100:80' //a wrong proxy
            )
  );
  
  $context = stream_context_create($opts);
  
  $file = file_get_contents('http://ifconfig.me/ip', false, $context);
  </code></pre>