title: file_get_contents - failed to open stream: HTTP request failed
body: <p>I am getting the following error when I am trying to pass url values into "file_get_content" :</p>
  
  <blockquote>
    <p>file_get_contents(<a href="https://api.sandbox.amadeus.com/v1.2/flights/low-fare-search?origin=" rel="nofollow noreferrer">https://api.sandbox.amadeus.com/v1.2/flights/low-fare-search?origin=</a>$origin&amp;destination=$destination&amp;departure_date=$departure_date&amp;return_date=$return_date&amp;number_of_results=$number_of_results&amp;apikey=$apikey):
    failed to open stream: HTTP request failed! HTTP/1.1 401</p>
  </blockquote>
  
  <p>I read different possible solutions, but none of them seemed to work in my case</p>
  
  <pre><code>$origin = $_GET['origin'];
  $destination = $_GET['destination'];
  $departure_date = $_GET['departure_date'];
  $return_date = $_GET['return_date'];
  $number_of_results = $_GET['number_of_results'];
  $apikey = "sdflsdksdksdsdskd";
  
  ini_set("allow_url_fopen", 1);
  
  $json_url = file_get_contents('https://api.sandbox.amadeus.com/v1.2/flights/low-fare-search?origin=$origin&amp;destination=$destination&amp;departure_date=$departure_date&amp;return_date=$return_date&amp;number_of_results=$number_of_results&amp;apikey=$apikey');
  </code></pre>
  
  <p>The result from the $json_url is a simple valid JSON
  Any help will be highly appreciated.</p>
  
  <p><strong>EDIT:</strong>
  The problem is not with the API Key, when I hard-code it, the error code is different (400 Bad Request), but still  file_get_contents - failed to open stream: HTTP request failed</p>