AnsweredAssumed Answered

Trouble with getting remediation tickets via API (with ticket_list.php)

Question asked by Abner Almeida on Aug 21, 2015
Latest reply on Aug 21, 2015 by Abner Almeida

Hello, everyone o/


I need some help with the QualysGuard API.

For start, I must say that I suck at doing CURL stuff. I know PHP and I use it everyday at my job, but when it comes to using curl along with PHP, I can't say I know how to use it (not yet, at least).

With that said, I can tell you the problem:

I'm developing a web application that generates a bunch of reports with info on our customers. Keeping it in  a simple way, the application retrieves data from QualysGuard and from our internal sources.

From QualysGuard, I usually log in the UI, go to the Remediation tickets section and download a full list of all Open and Closed tickets, in CSV format.

After that I insert the data in my database so that the application can do its stuff with it.

The problem here is that with things the way they are now, every week (after each weekly scan) I need to download the mentioned lists, do some Excel stuff with it and upload the data to the DB.

After a long time searching the web, I found some things that might help me:


First: this Community post about a script named "ticket_list.php":

Get all Remediation ticket with ticket_list.php API

This ticket looks exactly what I need, and it'd be PERFECT if I got to use it.


But here comes the part where I'm having trouble: I don't know how to use curl to do get the stuff I need.

So, I searched for some example of connecting to the API with PHP, and I found this PHP class created by some guy named Peter:

Simple PHP Qualys API class


The class looks pretty good, I could even put it in my server and log in with my API user and password.


But now I'm stuck: how can I mix both these resources (the php class and the ticket_list.php script) to retrieve the list of all open and closed tickets in my account?

Do I even need that class?


By my understanding, the 'ticket_list.php' returns an XML file with all the data. If I could only generate that XML, I could do everything with it and insert the data to my DB. And if this works, I just need to set a cronjob on the server to run the script every week.


Soooo, can anybody help me?