Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curl POST request for wordpress install

Im trying to do a post request in a shell to invoke a wordpress install, but wordpress just tells me "you must provide an e-mail address". Here is what I have:

curl -X POST -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:12.0) Gecko/20100101 Firefox/12.0" -e "http://dev.example.com/yeshello/wp-admin/install.php?step=2" -H "Content-Type:application/x-www-form-urlencoded" -H "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Encoding:gzip, deflate" --data "?step=2&weblog_title=yeshello&user_name=admin&admin_password=admin&admin_password2=admin&admin_email=mathias%40example.com&Submit=Install+WordPress" http://dev.example.com/yeshello/wp-admin/install.php

Ive managed to get it to work in a Chrome plugin by the name Postman here is what I've set up there:

Headers

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:12.0) Gecko/20100101 Firefox/12.0 Referer: http://dev.feed.no/yeshello/wp-admin/install.php?step=2 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Encoding: gzip, deflate

Raw

this is raw data, the plugin have a field supporting that

step=2&weblog_title=yeshello&user_name=admin&admin_password=admin&admin_password2=admin&admin_email=mathias%40feed.no&Submit=Install+WordPress

URL

and finally there is a url field

http://dev.example.com/yeshello/wp-admin/install.php?step=2&weblog_title=yeshello&user_name=admin&admin_password=admin&admin_password2=admin&[email protected]&Submit=Install+WordPress

like image 743
Spoeken Avatar asked Aug 07 '26 10:08

Spoeken


1 Answers

And by the time I wrote the URL heading I tried use the whole url in the curl command, like this:

curl -X POST -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:12.0) Gecko/20100101 Firefox/12.0" -e "http://dev.example.com/yeshello/wp-admin/install.php?step=2" -H "Content-Type:application/x-www-form-urlencoded" -H "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Encoding:gzip, deflate" --data "?step=2&weblog_title=yeshello&user_name=admin&admin_password=admin&admin_password2=admin&admin_email=mathias%40example.com&Submit=Install+WordPress" http://dev.example.com/yeshello/wp-admin/install.php?step=2&weblog_title=yeshello&user_name=admin&admin_password=admin&admin_password2=admin&[email protected]&Submit=Install+WordPress

And it worked :) But I fugured, why not post this anyways. Hope it helps someone! And if anyone want to clarify why this has to be done, I would love to hear it.

like image 59
Spoeken Avatar answered Aug 10 '26 09:08

Spoeken



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!