in reply to Creating REST API
Take a look at LWP::UserAgent. It allows you to add custiom headers, handles cookies etc.