file get contents follow redirect

Solutions on MaxInterview for file get contents follow redirect by the best coders in the world

showing results for - "file get contents follow redirect"
Nele
06 Jun 2018
1$ch = curl_init();
2curl_setopt($ch, CURLOPT_URL, $url);
3curl_setopt($ch, CURLOPT_HEADER, TRUE);
4curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
5curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
6$a = curl_exec($ch);
7if(preg_match('#Location: (.*)#', $a, $r))
8 $l = trim($r[1]);