Linux curl request to login into my local wordpress

admin

Administrator
Staff member
I never dealed with requests before, but I really want to get into it.

I have my own local wordpress installed, where I have this request with this info from LiveHttpHeaders (firefox):

<strong>PS:</strong> I've excluded the data from post content, that was not really needed. Also tried with all the params, still not working.

<strong>POST</strong>

<strong>url:</strong>
Code:
http://localhost/wordpress/wp-login.php

<strong>HTTP Headers:</strong>

Code:
Host: localhost
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost/index.htm
Cookie: wp-settings-time-1=1379163132; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_bbfa5b726c6b7a9cf3cda9370be3ee91=admin%7C1379335932%7Ca34b99198037170f7e76dffd1c6bc1cb; wassup_screen_res=1366%20x%20768; wassup=NjE1ZWM0Yzk4MzczOWYxZTEwZmU4YWY5Y2NlOTkxNzU6OjEzNzkxNjUwNzU6OjEzNjYgeCA3Njg6OjEyNy4wLjAuMTo6dW5rbm93bjo6
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 113

<strong>Post Content:</strong>
log=admin&amp;pwd=parola19&amp;wp-submit=Log+In

<strong>I've made this curl in terminal to login:</strong>

Code:
sudo curl -x POST -d log="admin" -d pwd="parola19" -d wp-submit="Log+In" http://localhost/wordpress/wp-login.php &gt; /var/www/index.html

I get this error from curl: curl: (5) Couldn't resolve proxy 'POST'

<strong>For this command:</strong>

Code:
sudo curl -d log="admin" -d pwd="parola19" -d wp-submit="Log+In" http://localhost/wordpress/wp-login.php &gt; /var/www/index.html

<strong>I save it to a file, and I get this message on the page from wordpress:</strong>
ERROR: Invalid username. Lost your password?

<strong>Do you guys have any suggestions ?</strong>

<strong>Also this is source of the wordpress login form:</strong>

Code:
&lt;form name="loginform" id="loginform" action="http://localhost/wordpress/wp-login.php" method="post"&gt;
    &lt;p&gt;
        &lt;label for="user_login"&gt;Username&lt;br /&gt;
        &lt;input type="text" name="log" id="user_login" class="input" value="" size="20" /&gt;&lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
        &lt;label for="user_pass"&gt;Password&lt;br /&gt;
        &lt;input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /&gt;&lt;/label&gt;
    &lt;/p&gt;
    &lt;p class="forgetmenot"&gt;&lt;label for="rememberme"&gt;&lt;input name="rememberme" type="checkbox" id="rememberme" value="forever"  /&gt; Remember Me&lt;/label&gt;&lt;/p&gt;
    &lt;p class="submit"&gt;
        &lt;input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Log In" /&gt;
        &lt;input type="hidden" name="redirect_to" value="http://localhost/wordpress/wp-admin/" /&gt;
        &lt;input type="hidden" name="testcookie" value="1" /&gt;
    &lt;/p&gt;
&lt;/form&gt;