Hey all,
I know that the Ethernet code requires an IP to connect to, then the directory/page to connect to which is on that IP. I need to connect to api.tropo.com/myurlhere, but the url for api.tropo.com is the same as tropo.com. Anybody? Here is my code.
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { my mac address };
IPAddress server(199,230,56,121); // Tropo
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET api.tropo.com/1.0/sessions?action=create&token=mytoken&number=mynumber HTTP/1.0");
client.println();
}