Answers for "php file_get_contents redirect"

PHP
0

file_get_contents follow redirect

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
 $l = trim($r[1]);
Posted by: Guest on August-26-2020

Code answers related to "php file_get_contents redirect"

Browse Popular Code Answers by Language