0

I try to use ob_start() ob_end_flush(); to hide the errors. Is there no other way to fix this Cannot modify header information?

echo $claim_url;
require_once $_SERVER['DOCUMENT_ROOT'] . '/auto-faucet/lib/shortlink.php';
$claim_url = shortlink_create($claim_url);
header('Location: ' . $claim_url, true, 303);

1 Answers1

0

Before header there should not be anything in the output.

Remove echo $claim_url;

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

Documentation

NOTE: use die() or exit() after redirect.

vaso123
  • 12,347
  • 4
  • 34
  • 64