Using Lynx Cron Job to allow for PHP redirect -
i have php script ends header redirect, want schedule via cron job.
reading around took me 'lynx' library thought browser-lite way of doing cron job act in same way browser , able execute redirect.
a simplified version of script looks like:
<?php // connect db require_once($_server['document_root']."/admin/inc/dbconnect.php"); // check db quotes have not been sent client $query_quotes = "select * quotes sent_client = 0 limit 1"; $view_request = mysqli_query($globals['db_connect'], $query_quotes); // send external system , email customer quote while ($quotes = mysqli_fetch_array($view_request)){ $body = "email content"; // send email via swift mailer // send quote information third party system via url redirect header('location: http://exampleurl/?firstname='.rawurlencode($quotes['name']).'&businessname='.rawurlencode($quotes['company_name']).'.'); } ?>
it finds records in database sends customer email before compiling url information , redirecting it. variables in url read third party system , inputted database.
i'm activating cron job (via plesk scheduler) so:
/usr/bin/lynx -source http://exampleurl2/script.php > /dev/null
i know script being executed redirect part not working still, doing wrong lynx? tried recreating redirect function curl couldn't seem so.
Comments
Post a Comment