Jump to content
Sign in to follow this  

loginto a page using curl

Recommended Posts

im trying to log in to a page using curl to modify one of my post like updating that specific post with new information over the time

i dont understand very much curl and most of the examples i search are in php and i need it to use with autoit

right now im trying from the start, to get logged in the webpage

i have found that i need the names of the inputs user and password and that i need a cookie to receive and to send, but when i check the curl.txt in a browser it returns me to the login page, here is what i have

this is the page code where i found the inputs vb_login_username and vb_login_password

<!-- login form -->

        <form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">

        <script type="text/javascript" src="clientscript/vbulletin_md5.js?v=384"></script>

        <table cellpadding="0" cellspacing="3" border="0">


            <td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">Nombre de Usuario</label></td>

            <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="Nombre de Usuario" onfocus="if (this.value == 'Nombre de Usuario') this.value = '';" /></td>

            <td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />¿Recordarme?</label></td>



            <td class="smallfont"><label for="navbar_password">Contraseña</label></td>

            <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>

            <td><input type="submit" class="button" value="Iniciar Sesión" tabindex="104" title="Escribe tu nombre de usuario y contraseña en los campos para iniciar la sesión o pulsa el botón 'registrarse' para crear un perfil." accesskey="s" /></td>



        <input type="hidden" name="s" value="" />

        <input type="hidden" name="securitytoken" value="guest" />

        <input type="hidden" name="do" value="login" />

        <input type="hidden" name="vb_login_md5password" />

        <input type="hidden" name="vb_login_md5password_utf" />


        <!-- / login form -->

and here is the code im trying but i dont get results

#include <Constants.au3>
#include <GuiConstantsEx.au3>
$sCurl = @TempDir & '\curl.exe'
$sParam = '-b "C:\ cookiefile.txt" -c "C:\ cookiefile.txt" -d vb_login_username= -d vb_login_password=  -o "C:\curl.txt" --url http://www.vagos.es'
Run($sCurl & '" ' & $sParam)

code from wakillon

#include <GuiConstantsEx.au3>
#include <Constants.au3>

$_CurlPath = @TempDir & '\curl.exe'
$_Parameters = '-b "C:\curl\cookiefile.txt" -c "C:\curl\cookiefile.txt" -d vb_login_username=hioyikip -d vb_login_password=123456789 --url http://www.vagos.es'
$_Run = @ComSpec & ' /c ' & FileGetShortName ( $_CurlPath & ' ' & $_Parameters )
ConsoleWrite ( '-->-- $_Run : ' & $_Run & @Crlf )
$_Pid = Run ( $_Run, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD )
Dim $_StderrRead='', $_StdoutRead=''

While ProcessExists ( $_Pid )
    $_StderrRead = StderrRead ( $_Pid )
    If Not @error And $_StderrRead <> '' Then ConsoleWrite ( "+->-- STDERR read : " & $_StderrRead & @Crlf )
    $_StdoutRead = StdoutRead ( $_Pid )
    If Not @error And $_StdoutRead <> '' Then ConsoleWrite ( "!->-- STDOUT read : " & $_StdoutRead & @Crlf )

hope you can help me


Edited by seres

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...