Check out this link!

How to use MEGA API with php!