Following Redirects in CURL in PHP

The following command forces CURL to follow HTTP redirects:

curl.php<?php
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
?>
Задание 1

Given two pages:

page1.php<?php
  header('Location: page2.php');
  die();
?>
page2.php<?php
  echo 'success';
?>

Access the first page via CURL. Make sure it follows the redirect when the appropriate setting is enabled.