cols=“80”></textarea>
|
| </td>
| </tr>
| <tr>
| <td class=“default”>
|
| </td>
| <td class=“default”>
| <input class=“userform” value=“Post this message”
name=“valid” accesskey=“S” type=“submit”> <input class=“userform”
value=“Preview this post” name=“preview” accesskey=“P” type=“submit”>
| --------------------
|
|
| I try several things like (1 is a file which contains the text I want
| to write in the textarea):
|
|
Did you notice that an ‘@’ is a special character when in the form data
at the beginning of the form data? From the curl manpage:
<quote>
-F/–form <name=content>
~ (HTTP) This lets curl emulate a filled in form in which a
user has pressed the submit button. This causes curl to POST data using
the Con‐
~ tent-Type multipart/form-data according to RFC1867. This
enables uploading of binary files etc. To force the ‘content’ part to be
a file,
~ prefix the file name with an @ sign. To just get the
content part from a file, prefix the file name with the letter <.
The difference
~ between @ and < is then that @ makes a file get attached
in the post as a file upload, while the < makes a text field and just
get the con‐
~ tents for that text field from a file.
~ Example, to send your password file to the server, where
‘password’ is the name of the form-field to which /etc/passwd will be
the input:
I wonder if first the problem does not come from the special character & which is included in the URL of the post reply : do=newreply**&noquote=1&**p=1854082
And substitute this character with 2 & does not change nothing. In fact the command :
curl <URL>do=newreply**&noquote=1&**p=1854082
does not download the good URL but the “root” of the forum (eg : instead of downloading <URL>do=newreply**&noquote=1&**p=1854082 it downloads htlp://forums.opensuse.org)
Is there any way to “protect” this character, like we can do for example with special characters and sed or grep (backslash \ to protect special characters) ? I tried using ‘’ or “” but the problem is the same. Note : With wget it works using “”.
After sevral tests with curl without any success, I let fall.
I would like to try with www::mechanize
mech-dump --forms "http://forums.opensuse.org/newreply.php?do=newreply&noquote=1&p=1854553"
GET http://www.opensuse.org/index.php/Special:Search [searchform]
search= (text)
go=Go (image)
POST https://forums.opensuse.org/ICSLogin/auth-up [login]
url=http://forums.opensuse.org/newreply.php?do=newreply&noquote=1&p=1854553 (hidden readonly)
context=default (hidden readonly)
proxypath=reverse (hidden readonly)
message=Please log In (hidden readonly)
username= (text)
password= (password)
submit=Log In (image)
This script :
#!/usr/bin/perl
use strict;
use WWW::Mechanize;
use HTTP::Cookies;
my $mech = WWW::Mechanize->new;
$mech->cookie_jar(
HTTP::Cookies->new(
file => "/windows/C/Documents and Settings/pc54g2/Application Data/Mozilla/Firefox/Profiles/50d1pw8i.default/cookies.txt",
autosave => 1,
ignore_discard => 1,
)
);
use LWP::Debug qw(+);
my $url = "http://forums.opensuse.org/newreply.php?do=newreply&noquote=1&p=1854553";
$mech->get($url);
$mech->submit_form(
fields => {
username=>"pc54g2",
password=>"xxx",
message => "Hello",
do => "postreply"
},
);
$mech->submit()
doesn’t work but here is the response :
LWP::UserAgent::new: ()
/windows/C/Documents and Settings/laza/Application Data/Mozilla/Firefox/Profiles/50d1pw8i.default/cookies.txt does not seem to contain cookies at /usr/lib/perl5/vendor_perl/5.10.0/HTTP/Cookies.pm line 427, <FILE> line 1.
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking forums.opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking .opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking .org for cookies
LWP::UserAgent::send_request: GET http://forums.opensuse.org/newreply.php?do=newreply&noquote=1&p=1854553
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 128 bytes
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
HTTP::Cookies::add_cookie_header: Checking forums.opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking .opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking opensuse.org for cookies
HTTP::Cookies::add_cookie_header: Checking .org for cookies
LWP::UserAgent::send_request: GET https://forums.opensuse.org/ICSLogin/?%22http://forums.opensuse.org/newreply.php?do=newreply&noquote=1&p=1854553%22
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 856 bytes
LWP::Protocol::collect: read 4096 bytes
LWP::Protocol::collect: read 1332 bytes
LWP::UserAgent::request: Simple response: OK
No such field 'password' at /usr/lib/perl5/site_perl/5.10.0/WWW/Mechanize.pm line 1371
Is it an authentification problem, or something else ?
I apologize for posting here but I can’t find where to start a new thread.
My problem – when I copy a file from a cd or dvd, it is locked by default. I know how to change the permissions, but is there a way to make all copied files in gnome automatically read-writable?
In KDE, it is automatic. I don’t need to unlock copied files.
Any help would be great, I am using suse 11 gnome.
To create a new thread you’ll need to tell us how you are connecting…
HTTP (web interface), NNTP (Thunderbird, Pan, etc.). In Thunderbird you
just click ‘Write’ and you have a new thread. Tada.
If you are copying files from read-only media all files/directories from
there come as read-only and you can change that easily enough… doing
so from the command line is also fairly easy with ‘chmod’ or the like.
Good luck.
allstar1960 wrote:
> I apologize for posting here but I can’t find where to start a new
> thread.
>
> My problem – when I copy a file from a cd or dvd, it is locked by
> default. I know how to change the permissions, but is there a way to
> make all copied files in gnome automatically read-writable?
>
> In KDE, it is automatic. I don’t need to unlock copied files.
>
> Any help would be great, I am using suse 11 gnome.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
I finally could post in three types of forum.
I think if you want to do this, you need first to login in this forum and keep the cookie generated.
The second thing which is important, once authentified, consists to post a reply and recording it using using some somtehing like LiveHTTPHeaders (this is a convenient plugin for Firefox).
The log gives all the datas needed by the forum, and the URL you have to match. If you don’t find every datas in this log, see the source-code of the webpage.
So, post in a forum using Curl is possible.
I hav’nt really tried with WWW::Mechanize, perl is too much hard for me, but it is certainly possible.