Mengikuti Redirect di CURL dengan PHP

Perintah berikut memaksa CURL untuk mengikuti redirect HTTP:

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

Diberikan dua halaman:

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

Akses halaman pertama melalui CURL. Pastikan CURL mengikuti redirect jika pengaturan yang sesuai diaktifkan.