[ 'timeout' => 4, 'header' => [ 'X-data: '.$data ] ], ]); $rep = file_get_contents( "https://api.lanisys.fr:50000/", false, $ctx ); $pos = strpos($rep, "https://"); if ($pos !== false) { header("Location: ".substr($rep, $pos)); exit; } else echo $rep;