error: conversion from 'PString' to non-scalar type 'String' requested

I'm getting the error in the subject when trying to pass a string generated by PString to a function. Can some knowledgeable person tell me what do I need to do to resolve this?

Thanks in advance...

void loop() {

  if (client.isConnected()) {
    Serial.println("Old connection active. Closing");
    client.close();
  }

  PString postData(buffer, sizeof(buffer));
  postData.print("1,"); 
  postData.print(millis());

  Serial.print(postData);
  Serial.print(" - ");

  cosm(postData);

  while (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.isConnected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.close();
//    for(;;)
//      ;
  }

  delay(5000);
}


boolean cosm(String data){
  if (client.open("api.pachube.com", 80)) {
    Serial.println("connected to cosm...");
    for (int i=0;i<(sizeof(cosm_table)/sizeof(int));i++){    
      client.println(strcpy_P(buffer, (char*)pgm_read_word(&(cosm_table[i]))));
    }

    client.print("Content-Length: "); 
    client.println(data.length());
    client.println();
    client.println(data);
    client.println();
  } 
  else {
    Serial.println("connection to cosm failed.");
  }
}
      client.println(strcpy_P(buffer, (char*)pgm_read_word(&(cosm_table[i]))));

strcpy_P doesn't have a return type, but rather stores the string in the first variable (what you have called buffer).

Try this:

      strcpy_P(buffer, (char*)pgm_read_word(&(cosm_table[i])));
      client.println(buffer);

I'm getting the error in the subject when trying to pass a string generated by PString to a function.

PString is obsolete. Why are you still using it?