Solved

Auto filling

Posted on 2011-09-18
6
352 Views
Last Modified: 2012-05-12
I am trying to write a perl script to auto fill on a forum using WWW::Mechanize;
___________________________________________
use WWW::Mechanize;
$mech = WWW::Mechanize->new();
$input1 = "TITLE";
$input2 = "BODY";
$mech->get("URL");
$mech->form_with_fields(("subject","XXXX"));
$mech->field("subject",$input1);
$mech->field("XXXX",$input2);
$mech->submit_form();
_______________________________________________

From the source code of the webpage I came to know that TITLE "name=subject", but I am unable to find the name of the "BODY", for your reference I am attaching a screenshot of the BODY.

Can someone help me in finding the name of BODY?
 BODY Image
0
Comment
Question by:pravink22
  • 3
  • 3
6 Comments
 

Author Comment

by:pravink22
ID: 36556525
This is the code I found on source of the body:

<body id="tinymce" class="mceContentBody  wp-editor" dir="ltr"><p><br data-mce-bogus="1"></p></body>
0
 
LVL 23

Expert Comment

by:nemws1
ID: 36556722
I think maybe you need to look for a TEXTAREA form element instead.
0
 
LVL 23

Expert Comment

by:nemws1
ID: 36556771
Can you post the HTML Code of the entire FORM (from <FORM...> to </FORM>)?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:pravink22
ID: 36556913
its a wordpress, admin posting page
0
 
LVL 23

Accepted Solution

by:
nemws1 earned 500 total points
ID: 36557002
Ah, the id & name for that is simply 'content' (easily found using Firefox w/ the Web Developer add-on and calling Web Developer -> Forms -> Display Form Details) .  Looking at Post submission page in one of my WordPress installs, I'd do something like this (I don't see a 'subject' field in mine, but I do see a 'title'):
use WWW::Mechanize;
$mech = WWW::Mechanize->new();
$input1 = "TITLE";
$input2 = "BODY";
$mech->get("url.to.wordpress/post-new.php");
$mech->form_with_fields(("title","content"));
$mech->field("title",$input1);
$mech->field("content",$input2);
$mech->submit_form();

Open in new window

0
 

Author Comment

by:pravink22
ID: 36558069
Its works Gr8... Thanks for sharing... :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Rename file based on contents in the file? 3 80
perl script to search for files containing text 3 73
Edit Odbc.ini using perl module 2 78
Perl Frameworks 1 81
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now