Automation though wget

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Automation though wget

Post by calguy1000 »

After many trials and tribulations, I managed to get wget to login to cms made simple, and to perform an admin action.  To do anything requires intimate knowledge of the php at the back end (to know what parameters to supply, wether they are via post or get, etc). But it's possible.

Here's the script I ended up with.  Of course, I could improve on it, but, you'll get the point.

Code: Select all

#!/bin/sh
rm /tmp/login.php* /tmp/index.php* /tmp/moduleinterface.php*
sitename='http://www.mysite.com'
cookies=/tmp/cookies.tmp
postdata='username=theusername&password=thepassword&loginsubmit=Submit'

cd /tmp
wget --save-cookies ${cookies} --keep-session-cookies --post-data=$postdata ${sitename}/admin/login.php
wget --load-cookies ${cookies} ${sitename}/admin/moduleinterface.php\?mact=FileMailer,m1_,admin_setfiles,0
rm /tmp/cookies.tmp
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Pierre M.

Re: Automation though wget

Post by Pierre M. »

Cool, thank you.

I suggest to use it with a dedicated admin user, say "botuser" : this way you can see it acting in the admin log.

Pierre M.
Pierre M.

Re: Automation though wget

Post by Pierre M. »

calguy1000 wrote: After many trials and tribulations, I managed to get wget to login to cms made simple, and to perform an admin action.  To do anything requires intimate knowledge of the php at the back end (to know what parameters to supply, wether they are via post or get, etc). But it's possible.
Hey, wait !
This is a powerfull automated testing tool :-)

The QA should like it : it provides a way to automate regression testing.
The developers may like it : it provides a way for eXtrem Programming (coding the tests then the feature) if they like XP.

Documentation's users' cases can become test cases.

Too lazy... I hadn't seen all the power ;-)

Pierre M.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Automation though wget

Post by calguy1000 »

Yes, it is an excellent automated testing tool.

I need to write a couple of scripts.... one for populating a couple of hundred news items into the database, and one for populating some FEU users.

The problem is, it take time to write all of these things.... and the permutations and combinations would be combersome.  As well, this is only 1/2 of the solution, as I provide no way at this time to validate the result of everything.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Developers Discussion”