I need to prevent the program from executing the redirect so I can see the sensitive information
<?php
$redirect_url = 'page2.php';
header("Location: " . $redirect_url);
?>
<div id="demo">This is sensitive information</div>
I expect the code to remain at the same page without redirecting to page2
I want to do it using the terminal or an external command supposing that I don't control the site.
You can use curl which does not follow redirects by default.
See Is there a way to follow redirects with command line cURL?
curl mysite.com