cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Post in a forum

From: lakk_esbjrn <lakk_esbjrn_at_yahoo.fr>
Date: Sat, 23 Aug 2008 15:05:24 +0200

Daniel Stenberg a écrit :
> On Sat, 23 Aug 2008, lakk_esbjrn wrote:
>
> Please don't top-post!
>
>> where the login source code is the following :
>
> Uh, that didn't even contain the <form> tag...
>
>> Username and Password are very simple and the same : only alphabetical
>> characters. As you say, I have to first keep the cookie which contains
>> the collected data of the authentification :
>>
>> /curl -A "Mozilla/5.0" -d "username=AbCd&password=AbCd=Connexion" -c
>> "Cookie1.txt" "http://www.nameforum.org/phpBB3/index.php" /
>
> I doubt that is the correct URL to login to. The <form> tag would show
> if I'm right.
>
>> But It gives me the source code of the login page... The cookie
>> Cookie1.txt contains :
>>
>> #HttpOnly_.nameforum.org TRUE / FALSE 1251016841
>
> httponly cookies weren't supported until curl 7.18.1 so I hope you
> have at least that version!
>

OK, sorry for the top post. I use the latest version of cURL :
/curl 7.18.1 (i686-suse-linux-gnu) libcurl/7.18.1 OpenSSL/0.9.8g
zlib/1.2.3 libidn/1.8
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz/

You're right, the good URL to login in this forum is in fact :
http://www.nameforum.org/phpBB3/ucp.php?mode=login
So I tried this :

/curl -A "Mozilla/5.0" -d "username=AbCd&password=AbCd&login=Connexion"
-c "Cookie1.txt"
"http://www.alt-shift-return.org/phpBB3/ucp.php?mode=login"/

And it works ! I can see in the response the message "you're now
connected to the forum", and I see the user AbCd in the list of the
connected members of the forum. That's great. Cookie1 is saved in the
current directory (/home/user/Cookie1.txt)
Now I want to write a short message "Hello" in the following form reply
http://www.nameforum.org/phpBB3/posting.php?mode=reply&f=24&t=55

Here are some elements of the source-code of this reply

/<form id="postform" method="post" action="./posting.php?mode=reply&amp;f=24&amp;sid=7b7ba2f32e8dca1e36e626b301f71401&amp;t=55" enctype="multipart/form-data">

/

/<textarea name="message" id="message" rows="15" cols="76" tabindex="3"
onselect="storeCaret(this);" onclick="storeCaret(this);"
onkeyup="storeCaret(this);" class="inputbox"></textarea>
/

/
<fieldset class="submit-buttons">
                                                <input name="topic_cur_post_id" value="844" type="hidden"><input name="lastclick" value="1219496168" type="hidden"> <input accesskey="k" tabindex="8" name="save" value="Sauvegarder" class="button2" type="submit">&nbsp; <input tabindex="5" name="preview" value="Aperçu" class="button1" onclick="document.getElementById('postform').action += '#preview';" type="submit">&nbsp;
                        <input accesskey="s" tabindex="6" name="post" value="Envoyer" class="button1" type="submit">&nbsp;

                </fieldset>/

So I try this cURL's options :

/curl -A "Mozilla/5.0" -b "Cookie1.txt" -d "message=Hello&post=Envoyer" "http://www.nameforum.org/phpBB3/posting.php?mode=reply&f=24&t=55"/

But the response say that I need to register if I want to post a reply. I tried with -F instead of -d but it changes nothing.

I'm sure the solution is not far...

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-08-23