Tag Archives: cURL

My story of PHEAL

When I took over the “job” of maintaining the EVE API for phpBB mod back in 2010 there was much to be done. It only had the functionality to set a single forum group for either one corporation or one alliance. No TeamSpeak integration, no Jabber integration, and only based of a simple XML request without caching or error checking. Yes it was still working, but the increased popularity of the EVE Online API caused more strain on the API servers which became more and more unstable.

Simply put, I was in need of something that would obey the API’s rules of caching and error handling. I came up with two possibilities: Pheal and Yapeal. Pheal focussed more on grabbing the information and doing something with it straight away, while Yapeal had the ability to throw it in a database to look at it later. As I was only in need of smaller snippits of information that needed processing straight away, I ended up choosing for Pheal.

I changed the code to use Pheal where possible, increased the amount of features the mod had and added proper error checking to not spam the API servers when it’s not receiving the expected response. Pheal uses either cURL or url_fopen to request data from the EVE API servers. Where url_fopen is best used accessing local files, cURL allows for exotic options (like setting the user agent, adding timeouts, etc) which is perfect for accessing internet files and services. Not to mention that url_fopen is often blocked by hosters for security reasons. So cURL it is.

A problem with cURL however is that by default it doesn’t have any certificates installed. Without the proper certificates I would not be able to request/access secured content using cURL over SSL. As SSL was now mandatory for EVE Online API requests, this became a big problem. It wasn’t a simple fix of installing the certificate either, as it would have to be done to each webhosting server that uses my mod.

I decided on using a much simpler but more “hacky” solution; I added the required certificate to my mod and changed the cURL code within Pheal to use that certificate. Example below, where you can see I added the code just before the cURL connection was made, while I also had to add a simple path fix to be sure the certificate was properly loaded from the phpBB ACP.