I want to send a get request to twitter to return a large number of results. How do I set this up so that once I start the request from a PHP web page, I don’t have to stay there and wait for the response?
Ideally, I’d like to start the request then have the result emailed to me when it is ready. Is this possible please?
PHP scripts have a 30 second running limit by default. You’ll definitely have to work around that first. I believe the function is
set_time_limit(0);which allows the script to execute indefinitely.Luckily, closing a browser window will never terminate the script you’re executing. You could probably use an invisible iframe to start the script. You’ll definitely want to safeguard against executing the frame twice, but once the iframe hits the script, it’ll run until it’s done.
Note that this is a hack, and that there are cleaner ways to do this, such as a cron.