Thursday, February 10, 2011

February is awesome

1) Short month.
2) Getting awesome surf in.
3) Got iTorque 2D for $94 bucks (I still have no idea how to use it but that's what vacation is for & surfing).
4) Finally replaced my Daihatsu master window control (myself and it works).
5) Weather is nice.
6) Work galore this month.

Million ideas at million miles a second but gotta stay focussed. There is nothing worse then a developer with a.d.d.


Wednesday, February 2, 2011

Bugzilla API Request via PHP

Have you tried to use the Bugzilla API and fell flat on the face unless you are using Python, Perl, C#, Java or anything but PHP (I still like PHP). Sadly I couldn't get any XMLRPC clients to work with the xmlrpc.cgi because prior to 3.6 versions of the API, Bugzilla authenticated via cookies. Zend Framework seems to support this but it also happens to be a lot of work just to create a ticket. Well fear not, I RTFM over and over and found this little note:

You can specify Bugzilla_login and Bugzilla_password as arguments to any WebService method, and you will be logged in as that user if your credentials are correct.


Documented in a very obscure place and 3.6 documentation is not the first to come up on Google. Here is some code via Codeigniter that does the trick but I assume any XMLRPC client will do the job with this concept.

$this->xmlrpc->server('', 80);

$request = array('Bugzilla_login'=>'', 'Bugzilla_password'=>'your_password', 'product'=>'Your Product Name', 'component'=>'User Submitted', 'summary'=>'Test', 'version'=>'x.x', 'description'=>'asdas');

$this->xmlrpc->request(array(array($request, 'struct')),'struct');

if(!$this->xmlrpc->send_request()) {
echo $this->xmlrpc->display_error();

// this returns ticket ID

Enjoy this, took me a while to figure it out.