I have a form page in PHP that reads a DBF, and conditionally converts it into a MySQL – extracting the data from an old, but still production accounting app. The conversion should be able to be actioned without user intervention, ie scripted from the web-host’s command line on a cron job.
How can I get PHP to submit the form automatically when receiving variables at command line, like for instance a specific post variable? Every auto-submit I’ve found so far relied upon javascript, which would be useless at PHP command line.
If I understand you correctly, you are trying to pass data to a PHP script automatically that used to be passed through a HTML form. When automating this process in a cron job, no form is rendered so auto-submitting it is out of the question – you will usually pass the data to the script straight away.
Methods to do that include:
If your form data is tiny (less than 1k, no file uploads) then you could call the script from the cron job, but still through the web server, using
wgetorcurl:If your form data is more than 1-2 kilobytes, use
curlto pass the fields as POST values (see the manual oncurl)Call the PHP script from the command line using the PHP binary; pass the data as arguments to the script. Details here
If the data is too much to be passed through the command line, put it into a temporary file and have your PHP script parse that.