Update api.php

fixed redirect and removed fb lib