Indeed, filtering using REMOTE_ADDR is the best if both servers are yours.
What's important to note, too, is that if curl_exec can't fetch the data for some reasons it will return false. That means that your script will echo nothing. People using it should take care on the javascript side to check the data they get and if it's empty display an error.
Please please please add some caching mechanism to your script. You do not want to allow some kiddie to flood another website using your script. Even 1-minute cache is enough, but just don't call this website everytime like this. Not only will it be slow but the other site owner might get angry at you.