Port of Facebook's php sdk