Your situation is similar to the scenario in this tutorial: Execute a HTTP POST Using PHP CURL. Also see the first comment on that page which may or may not be relevent here:
Your idea is simple enough tho if you’re going to be continually working with this remote database with limited access (are you working with a 3rd party?) you might want to use something a little more standard like SOAP or REST so that you can have error checking, etc.
Since you didn't give any details about your specific needs, I can't give any code that's relevant to your situation.