前置き 外部APIを呼び出す実装を行う際に、用意されていたサーバーのモジュールがバラバラでcurlが使用できない条件だったので、file_get_contentsを使用し外部APIで呼び出すのにハマったのでメモ的に記載しておく。 環境は php7.2 fuelphp1.8 ハマりどこ ブラウザでたたくときちんとJSONコードが返ってくるが、file_get_contentsで呼び出すと、下記Warningが出てしまった。 Fuel\Core\PhpErrorException [ Warning ]: file_get_contents(http://hogehoge/auth/login): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized 結果 file_get_contents の第三引数に渡す