curl-users
Re: Post in a forum
Date: Sun, 24 Aug 2008 11:00:59 +0200
Daniel Stenberg wrote :
> On Sat, 23 Aug 2008, lakk_esbjrn wrote:
>
>> Here are some elements of the source-code of this reply
>>
>> <form id="postform" method="post"
>> action="./posting.php?mode=reply&f=24&sid=7b7ba2f32e8dca1e36e626b301f71401&t=55"
>> enctype="multipart/form-data">
>
>> 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"
>
> That's the wrong URL as clearly the <form> above mentions a long
> sid=7b7ba2... etc as well.
>
>> 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.
>
> The <form> says multipart/form-data which means you MUST use -F.
>
Daniel,
Perhaps it will be easier if I show all the source-code of the reply
form, here it is (in this thread, the first message is just "Test" and
has been posted by "Admin". Here it is
http://www.cijoint.fr/cjlink.php?file=cj200808/cijuEE7onE.txt
Secondly, here is the log generated by LiveHTTP headers when I post a
reply as user "AbCd" :
/
http://www.NameForum/phpBB3/posting.php?mode=reply&f=24&sid=a442603482c15280329f8356306ceb70&t=55
POST
/phpBB3/posting.php?mode=reply&f=24&sid=a442603482c15280329f8356306ceb70&t=55
HTTP/1.1
Host: www.NameForum
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.1)
Gecko/2008070400 SUSE/3.0.1-4.1 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.NameForum/phpBB3/posting.php?mode=reply&f=24&t=55
Cookie: style_cookie=printonly; phpbb3_c9p2n_u=54; phpbb3_c9p2n_k=;
phpbb3_c9p2n_sid=a442603482c15280329f8356306ceb70
Content-Type: multipart/form-data;
boundary=---------------------------13121004521764354617663418066
Content-Length: 1467
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="subject"
Re: Test
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="addbbcode20"
100
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="message"
Test2
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="topic_cur_post_id"
844
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="lastclick"
1219566319
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="post"
Envoyer
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="attach_sig"
on
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="creation_time"
1219566319
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="form_token"
4db265048839439a1d6ef0eed111fc7523ffffa0
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="fileupload"; filename=""
Content-Type: application/octet-stream
-----------------------------13121004521764354617663418066
Content-Disposition: form-data; name="filecomment"
-----------------------------13121004521764354617663418066--
HTTP/1.x 200 OK
Date: Sun, 24 Aug 2008 08:27:13 GMT
Server: Apache/1.3.34 Ben-SSL/1.55
Cache-Control: private, no-cache="set-cookie"
Expires: 0
Pragma: no-cache
X-Powered-By: PHP/4.4.9
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
http://www.NameForum/phpBB3/viewtopic.php?f=24&t=55&p=846#p846
GET /phpBB3/viewtopic.php?f=24&t=55&p=846 HTTP/1.1
Host: www.NameForum
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.1)
Gecko/2008070400 SUSE/3.0.1-4.1 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: style_cookie=printonly; phpbb3_c9p2n_u=54; phpbb3_c9p2n_k=;
phpbb3_c9p2n_sid=a442603482c15280329f8356306ceb70
HTTP/1.x 200 OK
Date: Sun, 24 Aug 2008 08:27:17 GMT
Server: Apache/1.3.34 Ben-SSL/1.55
Cache-Control: private, no-cache="set-cookie"
Expires: 0
Pragma: no-cache
X-Powered-By: PHP/4.4.9
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
http://www.NameForum/phpBB3/cron.php?cron_type=queue
GET /phpBB3/cron.php?cron_type=queue HTTP/1.1
Host: www.NameForum
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.1)
Gecko/2008070400 SUSE/3.0.1-4.1 Firefox/3.0.1
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.NameForum/phpBB3/viewtopic.php?f=24&t=55&p=846
Cookie: style_cookie=printonly; phpbb3_c9p2n_u=54; phpbb3_c9p2n_k=;
phpbb3_c9p2n_sid=a442603482c15280329f8356306ceb70
HTTP/1.x 200 OK
Date: Sun, 24 Aug 2008 08:27:18 GMT
Server: Apache/1.3.34 Ben-SSL/1.55
Cache-Control: no-cache
X-Powered-By: PHP/4.4.9
Content-Length: 43
Keep-Alive: timeout=2, max=199
Connection: Keep-Alive
Content-Type: image/gif
/And the Cookie1.txt file which is generated after the successful
authentification of this user "AbCd"/
# Netscape HTTP Cookie File
# http://curlm.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_.NameForum.org TRUE / FALSE 1251103417
phpbb3_c9p2n_u 54
#HttpOnly_.NameForum.org TRUE / FALSE 1251103417
phpbb3_c9p2n_k
#HttpOnly_.NameForum.org TRUE / FALSE 1251103417
phpbb3_c9p2n_sid 6e6d64b26415bfcae80ecee7a6259c53
/Don't you think some data could miss in this file Cookie1.txt in regard
to the log HTTPLive ?
So as you said, I use the -F option to post this reply but.... does not
work... and AbCd is strangely disconnected a few minutes after (10
minutes approximatively)
/curl -b "Cookie1.txt" -F "message=Hello&post=Envoyer"
"http://www.NameForum.org/phpBB3/posting.php?mode=reply&f=24&sid=a442603482c15280329f8356306ceb70&t=55"/
-------------------------------------------------------------------
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-24