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