How to get my long-running, many-redirects script to bypass “page isnt redirecting properly” error?

Question

I have a script that takes about 5 minutes and must be run many times. So, I have it set up on CF Administrator as a scheduled task. (even though it’s a php script) Basically this:

<?php
$n = $_GET['n'];
// do a bunch of stuff, with $n

$url = 'https://example.com/?n='.$n +1;
header("Location: $url");
exit();

And so on, for about 350 iterations. It usually gets through 20-50 iterations, before "page isnt redirecting properly".

If i do this, manually:
<script> window.open('https://www.example.com/?n=2', '_blank');</script>
It works fine, opens all the tabs, runs all the scripts, no problem.

This script is on wordpress, but it’s not really doing all the normal wp stuff, it’s only on wp for convenience.

0
Doug Cassidy 3 months 0 Answers 7 views 0

Leave an answer