curl-users
Re: Post in a forum
Date: Sat, 30 Aug 2008 14:20:23 +0200
Daniel Stenberg a écrit :
> On Fri, 29 Aug 2008, lakk_esbjrn wrote:
>
>> /curl -b "/home/xxx/Cookie1.txt" -F message=Hello -F post=Envoyer
>> "http://www.nameforum.org/phpBB3/posting.php?mode=reply&f=24&t=55&sid=75661bad3cc1a6560a611af494fe683f"/
>>
>>
>> it does not work (response is "you need to be registered to post a
>> reply...").
>>
>> Syntax is not correct ? Do I miss something else ?
>
> Most likely, yes. See chapter 14 down at the bottom in this document:
>
> http://curl.haxx.se/docs/httpscripting.html
>
Thank you for the link. I tried consequently to add more parameters that
appear in the Live HTTP Log, and to complete the UserAgent something
like that :
curl -b "Cookie1.txt" Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.1)
Gecko/2008070400 SUSE/3.0.1-7.1 Firefox/3.0.1" -e
http://www.nameforum.org/phpBB3/ -F "subject=Re: Test" -F
addbbcode20=100 -F message=Hello -F topic_cur_post_id=844 -F
lastclick=1219766783 -F post=Envoyer -F attach_sig=on -F notify=on -F
creation_time=1219766784 -F
form_token=a7aebc97d062f96cd176bedfb557934574b377b4
"http://www.nameforum.org/phpBB3/posting.php?mode=reply&f=24&t=55&sid=$SID"
Of course it doesn't work. I obtain a response which say that the form
is not valid and that I have to try again.
The -v option give this log before the response:
* About to connect() to www.nameforum.org port 80 (#0)
* Trying 87.106.113.144... connected
* Connected to www.nameforum.org (87.106.113.144) port 80 (#0)
> POST
/phpBB3/posting.php?mode=reply&f=24&sid=1fac0c66476e352e006762f49be58962&t=55
HTTP/1.1
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.1)
Gecko/2008070400 SUSE/3.0.1-7.1 Firefox/3.0.1
> Host: www.nameforum.org
> Accept: */*
> Referer: http://www.nameforum.org/phpBB3/
> Cookie: phpbb3_c9p2n_sid=bd5c4f425ca0f934c504e64aef219153;
phpbb3_c9p2n_k=; phpbb3_c9p2n_u=54
> Content-Length: 349
> Expect: 100-continue
> Content-Type: multipart/form-data;
boundary=----------------------------b90d4703f58e
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Sat, 30 Aug 2008 12:12:35 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
* Replaced cookie phpbb3_c9p2n_u="1" for domain nameforum.org, path /,
expire 1251634355
< Set-Cookie: phpbb3_c9p2n_u=1; expires=Sun, 30-Aug-2009 12:12:35 GMT;
path=/; domain=nameforum.org; HttpOnly
* Replaced cookie phpbb3_c9p2n_k="" for domain nameforum.org, path /,
expire 1251634355
< Set-Cookie: phpbb3_c9p2n_k=; expires=Sun, 30-Aug-2009 12:12:35 GMT;
path=/; domain=nameforum.org; HttpOnly
* Replaced cookie phpbb3_c9p2n_sid="6d6e2d22828c5a31b50e7c5ef71560b4"
for domain nameforum.org, path /, expire 1251634355
< Set-Cookie: phpbb3_c9p2n_sid=6d6e2d22828c5a31b50e7c5ef71560b4;
expires=Sun, 30-Aug-2009 12:12:35 GMT; path=/; domain=nameforum.org;
HttpOnly
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-standard"
xml:lang="fr-standard">
<head>
etc etc
wow, how fucking hard it is... Thanks again
-------------------------------------------------------------------
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-30