php file_get_contents follow redirect file_get_contents follow redirect

The solution for “php file_get_contents follow redirect file_get_contents follow redirect” can be found here. The following code will assist you in solving the problem.

$context = stream_context_create(
array(
‘http’ => array(
‘follow_location’ => true/false
)
)
);

$html = file_get_contents(‘http://www.example.com/’, false, $context);

var_dump($http_response_header);
$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]);

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in