title: file_get_contents() "failed to open stream: Network is unreachable" error on valid link
body: <p>There's an extremely simple example of using Youtube API in php that somehow fails to work in my case, and I couldn't find a definitive solution for.</p>
  
  <p>I desire to use the Youtube API without any wrapper, by myself, to get data of videos. The following <code>search:list</code> query works perfectly when I try accessing it from within by browser (as a link), but in php, I get that error when I try the same.</p>
  
  <pre><code>        $apikey_YT = &lt;my API key&gt;;
          $ytrequrl = "https://www.googleapis.com/youtube/v3/search?".
                  "part=snippet".
                  "&amp;maxResults=50".
                  "&amp;q=doom".
                  "&amp;relatedToVideoId=h8j2zj-A5tE".
                  "&amp;type=video".
                  "&amp;key=${apikey_YT}";
  
          $result = file_get_contents($ytrequrl);
          var_dump($result);
  </code></pre>
  
  <p>The potential issues were URL encoding, or allowing <code>allow-url-fopen</code>, but neither seemed to help in my case: the former actually gave a new error message: <code>No such file or directory</code>.</p>
  
  <p>What can I do?</p>