Manipulate http request


I am looking for some info on how i can change the url that is formed by this code It is part of already functioning arduino mega. Currently it creates this url:,0 HTTP/1.1

i want to replace "UserEvent%20" , with "idx="

and, replace the number after the comma with "On" in case number is 1, and "Off", in case that number after comma is 0

I know that UserEvent%201,0 is stored or referenced by "TempString", so i have to somehow perform magic on TempString....

Could someone point me in the direction how i can do that?

byte SendHTTPEvent(struct NodoEventStruct *Event)
  byte x;

  if(Settings.TransmitHTTP==VALUE_OFF || Settings.HTTPRequest[0]==0)
    return false;

  char *HttpRequest=(char*)malloc(INPUT_LINE_SIZE);
  char *TempString=(char*)malloc(INPUT_LINE_SIZE);

  return x;

Actually, the significant code is in Event2str(), which you didn't post.