Arduino Uno with Ethernet Shield: query_time: could not connect to server

Hello, I am working on an Arduino Project to make a tweeting weather station, however I keep getting an error that I have no idea how to deal with. Whenever I start the program the serial monitor reads:

Arduino Twitter Home Weather Station
DHCP: 192.168.1.149
OK: Temp: 25 Humidity: 43
query_time: could not connect to server

I figured it was a problem with the Arduino connecting to twitter however I have no idea why. I have already inserted all of my unique Keys and Secrets and I do not know where to go from here.

Here is the Code (with my keys and secrets hidden):

#include <SPI.h>
#include <Ethernet.h>
#include <sha1.h>
#include <Time.h>
#include <EEPROM.h>
#include <Twitter.h>
#include <dht11.h>

#define DHT11PIN 6
dht11 DHT11; // create DHT11 as a dht11 class
int DHTread = 0; // set DHTread as an integer variable
int temp = 0; // set temp as integer variable
int humid = 0; // set humid as integer variable
int sensorCheck = 0;

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEC };

IPAddress twitter_ip(199, 59, 150, 39);
uint16_t twitter_port = 80;

unsigned long last_tweet = 0;

#define TWEET_DELTA (5L * 60L)

char buffer[512];

// Your Twitter consumer key and secret go here
const static char consumer_key[] PROGMEM = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
const static char consumer_secret[] PROGMEM = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

Twitter twitter(buffer, sizeof(buffer));

void setup()
{

  pinMode(7,OUTPUT); // set pin '7' to output mode
  pinMode(4,OUTPUT); // set pin '4' to output mode
  pinMode(6,INPUT_PULLUP);
  digitalWrite(4,LOW); // push pin '4' low
  digitalWrite(7,HIGH); // pull pin '7' high

  Serial.begin(115200);
  Serial.println("Arduino Twitter Home Weather Station");

  if (Ethernet.begin(mac))
  {
    Serial.print("DHCP: ");
    Ethernet.localIP().printTo(Serial);
    Serial.println("");
  }
  else
    Serial.println("DHCP configuration failed");

  twitter.set_twitter_endpoint(PSTR("api.twitter.com"),
  PSTR("/1.1/statuses/update.json"),
  twitter_ip, twitter_port, false);
  twitter.set_client_id(consumer_key, consumer_secret);

  // Your Twitter App Access Token and Key go here, Token first
  twitter.set_account_id(PSTR("XXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXX"),
  PSTR("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));

  delay(500);
}

void loop()
{
  delay(1000);
  DHTread = DHT11.read(DHT11PIN);
  temp = DHT11.temperature; // read the temperature data, store it in variable 'temp'
  humid = DHT11.humidity; // do similar with humidity

    switch (DHTread) // depending on the error code return, do one of the following:
  {
  case DHTLIB_OK: 
    Serial.print("OK: ");
    sensorCheck = 1;
    break;
  case DHTLIB_ERROR_CHECKSUM: 
    Serial.print("Checksum error: ");
    break;
  case DHTLIB_ERROR_TIMEOUT: 
    Serial.print("timeout error: ");
    sensorCheck = 0;
    break;
  default: 
    break;
  }

  Serial.print("Temp: ");
  Serial.print(temp);
  Serial.print(" Humidity: ");
  Serial.println(humid);

  if (twitter.is_ready())
  {
    unsigned long now = twitter.get_time();

    if (last_tweet == 0)
    {
      Serial.print("Time: ");
      Serial.println(now);

      last_tweet = now - TWEET_DELTA + 15L;
    }

    if (now > last_tweet + TWEET_DELTA)
    {
      char msg[140];
      if (sensorCheck == 1) {
        sprintf(msg, "Temp: %dC Humidity: %d%% Time: %lu Sensor: OK IAmArduino.", temp, humid, now);
      } 
      else {
        sprintf(msg, "Temp: %dC Humidity: %d%% Time: %lu Sensor: **error** IAmArduino.", temp, humid, now);
      }
      Serial.print("Posting to Twitter: ");
      Serial.println(msg);

      last_tweet = now;

      if (twitter.post_status(msg))
        Serial.println("Status updated");
      else
        Serial.println("Update failed");
    }
  }

  delay(10000);
}

Hopefully somebody who knows a lot more about this topic can help me.

Thank you!

From dev.twitter.com:

This is an important notice for developers still using HTTP plaintext connections. On January 14th, 2014, connections to api.twitter.com will be restricted to TLS/SSL connections only.

The Arduino platform doesn't support SSL transport encryption, so you cannot twitter directly from the Arduino, you need some kind of relay/proxy (either a PC connected to the Internet or a server which does that task).

Hi,
I am facing the same problems with connecting my arduino uno to twitter
i actually have it connected through my Macbook to the internet but whenever it connects my mac loses connection as if it is all transferred to the arduino.

What can i do ?

What sketch are you using? What program runs on the Mac (if any)? What does "connected through my Mac" means? Does it translate between Ethernet and WiFi, Internet and USB (Serial) or any other kind of media conversion?

What can i do ?

Provide more information!