skip to Main Content

One a webpage there is a button / from is submitting a post request which calls via action
php_file_name.php?action=command.

Now I want to call this command from (bash) shell / cronjob.

P.S.: The PHP file is wp-admin/update-core.php from WordPress and the command is action=do-translation-upgrade. As WordPress does not provide an auto update function for this and there are no hints in WordPress boards I just want to do my own script for that.

Running curldoes not generate an error – but also did not succeed:

curl -v -d 'action=command' https://xxxx/php_file_name.php. But maybe this is not a practical way anyway because of needing login to the website.

As I am on the web-server itself I am able to run execute the PHP file directly with any user / rights needed.

Solutions like this use a request to an URL instead of calling an executable file.
Maybe I need to transform the command in the post request to function parameters similar to here?

2

Answers


  1. Anything hindering you from directly calling "php ‘path to file’/update-core.php"? The only problem would be that you need to pass the action as parameter of this call which would be different than the web access.

    Login or Signup to reply.
  2. If you are just trying to update the translations, try with WP-CLI

    wp language core update

    also try

    wp language plugin update / wp language theme update

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search