file_get_contents() gets 403 from api.github.com every time
<p>I call myself an experienced PHP developer, but this is one drives me crazy. I'm trying to get release informations of a repository for displaying update-warnings, but I keep returning 403 errors. For simplifying it I used the most simple usage of GitHubs API: GET <a href="https://api.github.com/zen" rel="noreferrer">https://api.github.com/zen</a>. It is kind of a hello world.</p>

<p>This works</p>

<ul>
<li>directly in the browser</li>
<li>with a plain <code>curl https://api.github.com/zen</code> in a terminal</li>
<li>with a PHP-Github-API-Class like <a href="https://github.com/KnpLabs/php-github-api" rel="noreferrer">php-github-api</a></li>
</ul>

<p>This works not</p>

<ul>
<li>with a simple <code>file_get_contents()</code>from a PHP-Skript</li>
</ul>

<p>This is my whole simplified code:</p>

<pre><code>&lt;?php
    $content = file_get_contents("https://api.github.com/zen");
    var_dump($content);
?&gt;
</code></pre>

<p>The browser shows <code>Warning: file_get_contents(https://api.github.com/zen): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden</code>, the variable <code>$content</code> is a boolean and <code>false</code>.</p>

<p>I guess I'm missing some sort of http-header-fields, but neither can I find those informations in the <a href="https://developer.github.com/v3/" rel="noreferrer">API-Docs</a>, nor uses my terminal <code>curl</code>-call any special header files and works.</p>