0

So i have a plugin that dose half the work, so i told my self why not make a bash file that can do that for me? with cronjob BUT the problem is that the Update part of my bash "script" is doing NOTHING at this point and im getting frustrated

#!/bin/bash

# Login to site
curl --data "log=roboot&pwd=123456" "https://test.com/wp/wp-login.php" -c wpcookie.txt

# Update product
curl -d "save=Update" -X POST "https://test.com/wp/wp-admin/post.php?post=3413&action=edit" -v -b wpcookie.txt | head -n 40
# #curl -d "submit=save" "https://test.com/wp/wp-admin/post.php?post=3413&action=edit" -b wpcookie.txt 


# remove cookie
rm -f wpcookie.txt

# exit the bash script
exit
  • 1
    Look at what your browser actually sends when you update a post. At the very least, you'll need a nonce. However, depending on what you're trying to do, it might be easier to use wp-cli or write a php script that loads WP and then uses WP's functions to update & manipulate posts. – janh Feb 5 '18 at 16:12
  • ooh i forgot about the nonce, thank you for the info. – Zoric Feb 6 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.