Using Ethernet shield to access Tropo via https:

Hi,

I have a couple of working projects that use a WS5100 Ethernet Shield to access Tropo to send SMS messages. It all works fine, but now Tropo wants their users to access the api using https.

The sample sketch is below:

#include <Ethernet.h>      
#include <SPI.h>           

#define TROPO_SMS_TOKEN ".... my token is really in here.  Delete it to post on this forum......."

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0x81, 0xED };
byte ip[] = { 192, 168, 1, 127 };  // home LAN
IPAddress gateway( 192, 168, 1, 1 );
IPAddress subnet( 255, 255, 255, 0 );

char server[] = "api.tropo.com"; 

EthernetClient client;

void setup() 
{
  Serial.begin(9600);
 
  Ethernet.begin(mac, ip); //, gateway, subnet);  // start the Ethernet connection
  delay(1000); // give the Ethernet shield a second to initialize
  char mySMS[25];
  strcpy(mySMS, "Hello+out+there");
  sendSMS(mySMS);
}

void loop()
{  
}

void sendSMS(char txtSMS[]) //client function to send/receive GET request data.
{
  if (client.connect(server, 80)) 
  {  
    Serial.println(F("connected"));

    client.print("GET /1.0/sessions?action=create&token=");
    client.print(TROPO_SMS_TOKEN);
    client.print("&phone=6095551212&msg=");   // phone number changed to protect the innocent
    client.print(txtSMS);
    client.println(" HTTP/1.0"); 
    client.println("Host: http://api.tropo.com");
    client.println(); //end of get request
  } 
  else 
  {
    Serial.println(F("Connection failed")); //error message if no client connect
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  
  while (client.connected() || client.available()) 
  { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println(F("\n\ndisconnecting.\n"));
  client.stop(); //stop client
}

As shown above, it works. If I change the server variable to either of:

char server[] = "http://api.tropo.com";

or

char server[] = "https://api.tropo.com";

It says it connects on the serial monitor but nothing happens after that.

Any ideas why adding just http:// would cause it to fail? I can understand that maybe adding https:// might cause a problem (it shoudn't), but why would adding http:// be a problem?

Any ideas?

Thanks.

The Arduino can not do https.

OK, Thanks.

But shouldn't I still be able to prefix my server URL with http://

But shouldn't I still be able to prefix my server URL with http://

The URL for google is www.google.com. The protocol to talk to the server is http or https. The server name is NOT http://www.google.com.

So, no, you shouldn't.

Ahhhh, now I get it.

Do you know if the protocol is set by the Ethernet library or the board (curiosity)?

Either way, based on your comment, it looks like I'm going to have to find another way to send SMS messages from an Arduino sketch. And what I have has been working so well. Disappointment reigns :frowning: .

Thanks for the help - at least I don't need to keep spinning my wheels thinking it's something I'm doing.

Do you know if the protocol is set by the Ethernet library or the board (curiosity)?

The protocol that you need to use is set by the site that you want to access.

The protocols that the Arduino can support are limited by the amount of memory that the Arduino has.

https requires that all data send back and forth be encrypted and decrypted. The Arduino does not have enough memory to do that.

If you are looking to send a text message to your cellphone, you can use a standard email server like SMTP2GO.
yournumber@smsserver.com
Verizon's sms server is vtext.com.
Here is a website with most sms servers.
http://mfitzp.io/list-of-email-to-sms-gateways/

https requires that all data send back and forth be encrypted and decrypted. The Arduino does not have enough memory to do that.

Makes complete sense. Wasn't sure if encryption/decryption was handled in hardware or software. Since it is software, changing to a different kind of shield won't help. Thanks.

If you are looking to send a text message to your cellphone, you can use a standard email server like SMTP2GO

I'll search the forum for suggestions on sending emails from an Arduino. Thanks.

Here are my sketches on the playground. The second is for SMTP2GO.
http://playground.arduino.cc/Code/Email