Yes in this way i get the right response....How can i i change 0 with the value?
That's great news. Now we know the only problem is the format of the request string.
Your code to generate it using sprintf was along the right lines. You would need something like this:
char pageAdd[64];
int alarmstate=0;
sprintf(pageAdd, "/controlpanel/getalarm.php?alarmstate=%d", alarmstate);
That should produce the same behaviour as before. If it doesn't, print the value of pageAdd before you make the page request, and compare it carefully with the fixed string that you know works correctly.