getLinks api & support for older php version