Mega with wiznet shield (wire hack)+thingspeak+sd problem

If you are using a Mega, you should not be running out of SRAM unless something has gone wrong. It has 8K, compared to the Uno's 2K. I suspect maybe a buffer overflow is the cause.

Go back to the playground and upload that code again. Get it running. You had it running before. Change the network settings, the array size for pageAdd, and add "#include <SD.h>" at the top (edit: Change the pin for your SD card SS to the correct pin number in SD.begin). That's all!

Then add this to it:

int logFile(int temp0, int temp1, int temp2) {
  File fh = SD.open("test.txt",FILE_WRITE);
  if(!fh) {
    Serial.println("Open fail");
    return 0;
  }

  // Use the same character array here to send stuff to the file.
  // pageAdd array is global
  sprintf(pageAdd,"Field1=%u,Field2=%u,Field3=%u",temp0,temp1,temp2);
  fh.println(pageAdd);
  fh.close();
  return 1;
}

Don't call the the logFile routine in loop(). See if everything runs ok before you do.

Upload the code, then power down the Arduino for a few seconds, then power it up and open the serial monitor.