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

Since you have the values in the loop() function, I would put the SD routine immediately after the getPage() call. Like this:

if(!logFile(temp0,temp1)) Serial.println("Log failed");
else Serial.println("Log ok");

Here is logFile:

int logFile(int temp0, int temp1) {
  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",temp0,temp1);
  fh.println(pageAdd);
  fh.close();
  return 1;
}