The posted code is just fine it calls the URL
http://localhost:8080/HTTP_Connection/index.php
with the parameter firstKey and its value firstValue
Unless you forgot to do the imports which would result in a compile error to begin with.
I guess your error is on the server side. Please double check the server.
For sure your question is very unspecific – no exception, no exact description of what “function” you think is not called. Not what you expect to happen and what you miss of happening. Please adjust your question in a way that there can be a more concrete answer to your question.
solved Java function doesnt work [closed]