I have inherited some bad code in a Drupal 7.x site and it needs to be cleaned up. Several places in the code the URL is hard-coded and I want to change that. For example, in many of my javascript (.js) files I have something like this:
var url= 'http://dev3.ws.mysite.com/index.php/api/alerts_mix/x-api-key/blahhhhhhhhhzBkfqPTq4SWuCiLONePNfschNft';
In the PHP code I have the following:
$url="http://dev3.ws.mysite.com/api/checkin/x-api-key/blahhhhhhhhhuRCMIWM0Nw0rM2cDK7tTJTPW?uid=11<="
First question...is it OK to have the entire URL for the API (including the key) hard-coded or should we be calling this some other way?
Second...for both the js and PHP, what can I use in place of the HTTP and domain (http://dev3.ws.mysite.com) so it is a variable and gets those values from the config files so I don't need to change this every time when making a new dev site?